Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.