diff options
author | Jacob Mason <jacoblmason@gmail.com> | 2010-08-09 18:31:13 -0500 |
---|---|---|
committer | Jacob Mason <jacoblmason@gmail.com> | 2010-08-09 18:31:13 -0500 |
commit | 0f98c779c0813ffe3413f8678bb7c8cd88aabdab (patch) | |
tree | a18ca4493af5cebe6feefaf41a200b52b238dd41 /sphinx/websupport/storage/db.py | |
parent | 18ef86f0452595e0d7a414ceddfc9615ca476549 (diff) | |
download | sphinx-git-0f98c779c0813ffe3413f8678bb7c8cd88aabdab.tar.gz |
added get_metadata
Diffstat (limited to 'sphinx/websupport/storage/db.py')
-rw-r--r-- | sphinx/websupport/storage/db.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sphinx/websupport/storage/db.py b/sphinx/websupport/storage/db.py index 64f7f3e25..4a84cd086 100644 --- a/sphinx/websupport/storage/db.py +++ b/sphinx/websupport/storage/db.py @@ -112,6 +112,9 @@ class Comment(Base): proposal_diff = Column(Text) path = Column(String(256), index=True) + node_id = Column(Integer, ForeignKey(db_prefix + 'nodes.id')) + node = relation(Node, backref="comments") + def __init__(self, text, displayed, username, rating, time, proposal, proposal_diff): self.text = text @@ -127,12 +130,14 @@ class Comment(Base): # This exists because the path can't be set until the session has # been flushed and this Comment has an id. if node_id: + self.node_id = node_id self.path = '%s.%s' % (node_id, self.id) else: session = Session() parent_path = session.query(Comment.path).\ filter(Comment.id == parent_id).one().path session.close() + self.node_id = parent_path.split('.')[0] self.path = '%s.%s' % (parent_path, self.id) def serializable(self, vote=0): |