Created
November 12, 2015 22:00
-
-
Save millerdev/d394c98be89140457713 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dimagi.ext.couchdbkit import ( | |
Document, | |
DocumentSchema, | |
DictProperty, | |
IntegerProperty, | |
StringProperty, | |
) | |
class BlobMeta(DocumentSchema): | |
content_type = StringProperty() | |
content_length = IntegerProperty() | |
class AttachmentsMixin(object): | |
blobs = DictProperty(BlobMeta) | |
class RealDocument(AttachmentsMixin, Document): | |
doc_type = "RealDocument" | |
doc = RealDocument() | |
doc.blobs = {} | |
# TypeError: attribute name must be string, not 'NoneType' | |
doc.blobs["key"] = BlobMeta() | |
# AssertionError | |
doc2 = RealDocument(blobs={}) | |
# TypeError: attribute name must be string, not 'NoneType' | |
# how to set doc.blobs? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment