Skip to content

Commit

Permalink
allow CompressedTextProperty to be None
Browse files Browse the repository at this point in the history
  • Loading branch information
dound committed Apr 11, 2011
1 parent 358d4f5 commit 9eebd42
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,10 +685,15 @@ def __init__(self, level=6, *args, **kwargs):
super(CompressedTextProperty, self).__init__(level, *args, **kwargs)

def value_to_str(self, model_instance):
return self.__get__(model_instance, model_instance.__class__).encode('utf-8')
v = self.__get__(model_instance, model_instance.__class__)
if v is None:
return v
return v.encode('utf-8')

@staticmethod
def str_to_value(s):
if s is None:
return None
return s.decode('utf-8')

class DerivedDateProperty(db.DateProperty):
Expand Down

0 comments on commit 9eebd42

Please sign in to comment.