LongField, ListField) from brubeck.timekeeping import MillisecondField from brubeck.datamosh import OwnedModelMixin, StreamedModelMixin from brubeck.models import User, UserProfile # We're going to use ObjectIds for the id fields from dictshield.fields.mongo import ObjectIdField from dictshield.document import diff_id_field ### ### Override the id fields to be ObjectIdFields ### User = diff_id_field(ObjectIdField, ['id'], User) UserProfile = diff_id_field(ObjectIdField, ['id', 'owner_id'], UserProfile) ### ### List Models ### @diff_id_field(ObjectIdField, ['id', 'owner_id']) class ListItem(Document, OwnedModelMixin, StreamedModelMixin): """Bare minimum to have the concept of streamed item. """ # status fields liked = BooleanField(default=False) deleted = BooleanField(default=False) archived = BooleanField(default=False)
elem = SubElement(root, name) elem.text = str(value) elem.attrib = attribs # allow sub classes to add custom ad-hoc fields self._contribute_to_xml(root) return tostring(root) def _contribute_to_xml(self, etree): pass def _contribute_from_etree(self, etree): pass xml_exclude = list() class PyvotalDocument(Document, XMLMixin): """ Base class for pivotal objects representation """ # py25 class decorator PyvotalDocument = diff_id_field(IntField, ['id'])(PyvotalDocument) class PyvotalEmbeddedDocument(EmbeddedDocument, XMLMixin): """ Base class for embedded pivotal documents. i.e. tasks/notes """ pass
from brubeck.timekeeping import MillisecondField from brubeck.datamosh import OwnedModelMixin, StreamedModelMixin from brubeck.models import User, UserProfile # We're going to use ObjectIds for the id fields from dictshield.fields.mongo import ObjectIdField from dictshield.document import diff_id_field ### ### Override the id fields to be ObjectIdFields ### User = diff_id_field(ObjectIdField, ['id'], User) UserProfile = diff_id_field(ObjectIdField, ['id', 'owner_id'], UserProfile) ### ### List Models ### @diff_id_field(ObjectIdField, ['id', 'owner_id']) class ListItem(Document, OwnedModelMixin, StreamedModelMixin): """Bare minimum to have the concept of streamed item. """ # status fields liked = BooleanField(default=False) deleted = BooleanField(default=False) archived = BooleanField(default=False)
# allow sub classes to add custom ad-hoc fields self._contribute_to_xml(root) return tostring(root) def _contribute_to_xml(self, etree): pass def _contribute_from_etree(self, etree): pass xml_exclude = list() class PyvotalDocument(Document, XMLMixin): """ Base class for pivotal objects representation """ class Meta: id_field = IntField # py25 class decorator PyvotalDocument = diff_id_field(IntField, ['id'])(PyvotalDocument) class PyvotalEmbeddedDocument(EmbeddedDocument, XMLMixin): """ Base class for embedded pivotal documents. i.e. tasks/notes """ pass