aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/storage/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'libbe/storage/base.py')
-rw-r--r--libbe/storage/base.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/libbe/storage/base.py b/libbe/storage/base.py
index b43f765..9da60ad 100644
--- a/libbe/storage/base.py
+++ b/libbe/storage/base.py
@@ -272,10 +272,11 @@ class Storage (object):
else:
decode = False
value = self._get(*args, **kwargs)
- if decode == True and type(value) != types.UnicodeType:
- return unicode(value, self.encoding)
- if decode == False and type(value) != types.StringType:
- return value.encode(self.encoding)
+ if value != None:
+ if decode == True and type(value) != types.UnicodeType:
+ return unicode(value, self.encoding)
+ elif decode == False and type(value) != types.StringType:
+ return value.encode(self.encoding)
return value
def _get(self, id, default=InvalidObject, revision=None):