1. Waldemar Kornewald
  2. djangoappengine

Commits

Waldemar Kornewald  committed 05f951a

fixed bug when passing None to a TextField(null=True)

  • Participants
  • Parent commits 9f4cc0c
  • Branches default

Comments (0)

Files changed (1)

File db/compiler.py

View file
         elif db_type == 'longtext':
             # long text fields cannot be indexed on GAE so use GAE's database
             # type Text
-            value = Text((isinstance(value, str) and value.decode('utf-8')) or value)
+            if value is not None:
+                value = Text(value.decode('utf-8') if isinstance(value, str) else value)
         elif db_type == 'text':
-            value = (isinstance(value, str) and value.decode('utf-8')) or value
+            value = value.decode('utf-8') if isinstance(value, str) else value
         elif db_type == 'blob':
-            value = Blob(value)
+            if value is not None:
+                value = Blob(value)
         elif type(value) is str:
             # always store unicode strings
             value = value.decode('utf-8')