1. Benoit Chesneau
  2. py-restclient


ben...@couch.test  committed f2aa087

handle stuff that can't be decoded

  • Participants
  • Parent commits 23ec3c0
  • Branches default
  • Tags unicode

Comments (0)

Files changed (2)

File restclient/rest.py

View file
         if not is_unicode:
             return StrResourceResult(data, status_code, resp)
-        return UnicodeResourceResult(data, status_code, resp)
+        try:
+            return UnicodeResourceResult(data, status_code, resp)
+        except UnicodeDecodeError:
+            return StrResourceResult(data, status_code, resp)
     def make_uri(self, base, *path, **query):
         """Assemble a uri based on a base, any number of path segments, and query

File restclient/utils.py

View file
             # SafeUnicode at the end.
             s = s.decode(encoding, errors)
     except UnicodeDecodeError, e:
-        raise CouchitUnicodeDecodeError(s, *e.args)
+        raise e
     return s
 # Convert an IRI to a URI following the rules in RFC 3987