Author: ianb
Date: 2005-01-06 01:39:42 -0700 (Thu, 06 Jan 2005)
New Revision: 209
Modified:
Wiki/lib/wikipage.py
Log:
Added ad hoc author data (free form name, email URL), method to
retrieve comments on page.
Modified: Wiki/lib/wikipage.py
===================================================================
--- Wiki/lib/wikipage.py 2005-01-06 08:39:08 UTC (rev 208)
+++ Wiki/lib/wikipage.py 2005-01-06 08:39:42 UTC (rev 209)
@@ -18,6 +18,7 @@
import converter_registry
from html_abstracts import find_abstract
from common import *
+import user
# Just make sure these are loaded:
import convert_rest
@@ -149,7 +150,25 @@
relatedEntryLimit = metaprop('relatedentrylimit', 0,
converter=int)
relatedSortField = metaprop('relatedsortfield', 'creationDate')
+ authorUserID = metaprop('authoruserid', default=None,
+ converter=int)
+ # These are mostly for imported pages:
+ authorName = metaprop('author', None)
+ authorURL = metaprop('authorurl', None)
+ authorEmail = metaprop('authoremail', None)
+ def authorUser__get(self):
+ id = self.authorUserID
+ if not id:
+ return None
+ return user.manager.userForUserID(self.authorUserID)
+
+ def authorUser__set(self, author):
+ if author:
+ self.authorUserID = author.userID()
+ else:
+ self.authorUserID = None
+
def pageClass__get(self):
return self.metadata.get('pageclass', 'page')
@@ -169,7 +188,7 @@
elif link.startswith('https://'):
link = link[8:]
link = link.replace('#', '/')
- date_text = date.strftime('%Y-%m-%d')
+ date_text = self.creationDate.strftime('%Y-%m-%d')
domain, url = link.split('/', 1)
id = '%s,%s:%s' % (domain, date_text, url)
id = 'tag:' + id
@@ -210,6 +229,10 @@
conn.append((self.wiki.page(name), type))
return conn
+ def commentPages__get(self):
+ return [p for p, type in self.backConnections
+ if type == 'comment']
+
def backConnections__get(self):
return self.wiki.backConnections(self)
|