Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3337)

Unified Diff: boto/sdb/db/blob.py

Issue 8386013: Merging in latest boto. (Closed) Base URL: svn://svn.chromium.org/boto
Patch Set: Redoing vendor drop by deleting and then merging. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « boto/sdb/connection.py ('k') | boto/sdb/db/manager/__init__.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: boto/sdb/db/blob.py
diff --git a/boto/sdb/db/blob.py b/boto/sdb/db/blob.py
index 45a3624a6795a6c30c7786ca2f4dc42e9bf24b8d..b50794c9610545699c3cb2541db155f37e92ea13 100644
--- a/boto/sdb/db/blob.py
+++ b/boto/sdb/db/blob.py
@@ -37,17 +37,24 @@ class Blob(object):
return f
def __str__(self):
+ return unicode(self).encode('utf-8')
+
+ def __unicode__(self):
if hasattr(self.file, "get_contents_as_string"):
value = self.file.get_contents_as_string()
else:
value = self.file.getvalue()
- try:
- return str(value)
- except:
- return unicode(value)
+ if isinstance(value, unicode):
+ return value
+ else:
+ return value.decode('utf-8')
+
def read(self):
- return self.file.read()
+ if hasattr(self.file, "get_contents_as_string"):
+ return self.file.get_contents_as_string()
+ else:
+ return self.file.read()
def readline(self):
return self.file.readline()
« no previous file with comments | « boto/sdb/connection.py ('k') | boto/sdb/db/manager/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698