--- a/ForgeWiki/forgewiki/model/wiki.py
+++ b/ForgeWiki/forgewiki/model/wiki.py
@@ -133,7 +133,7 @@
@property
def attachments(self):
- return WikiAttachment.by_metadata(page_id=self._id,type='attachment')
+ return WikiAttachment.query.find(dict(artifact_id=self._id, type='attachment'))
@classmethod
def upsert(cls, title, version=None):
@@ -160,6 +160,10 @@
ss = HC.query.find({'artifact_id':pg._id, 'version':int(version)}).one()
return ss
+ @classmethod
+ def attachment_class(cls):
+ return WikiAttachment
+
def reply(self, text):
Feed.post(self, text)
# Get thread
@@ -185,20 +189,6 @@
return User.query.find({'_id':{'$in':user_ids}}).all()
class WikiAttachment(BaseAttachment):
- metadata=FieldProperty(dict(
- page_id=schema.ObjectId,
- app_config_id=schema.ObjectId,
- type=str,
- filename=str))
-
- @property
- def artifact(self):
- return Page.query.get(_id=self.metadata.page_id)
-
- @classmethod
- def metadata_for(cls, page):
- return dict(
- page_id=page._id,
- app_config_id=page.app_config_id)
+ ArtifactType=Page
MappedClass.compile_all()