diff options
Diffstat (limited to 'sphinx/websupport/storage/db.py')
-rw-r--r-- | sphinx/websupport/storage/db.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sphinx/websupport/storage/db.py b/sphinx/websupport/storage/db.py index 568558a3d..ed2b3b11c 100644 --- a/sphinx/websupport/storage/db.py +++ b/sphinx/websupport/storage/db.py @@ -132,9 +132,15 @@ class Comment(Base): 'iso': self.time.isoformat(), 'delta': self.pretty_delta(delta)} + path = self.path.split('.') + node = path[0] if len(path) == 2 else None + parent = path[-2] if len(path) > 2 else None + return {'text': self.text, 'username': self.username or 'Anonymous', 'id': self.id, + 'node': node, + 'parent': parent, 'rating': self.rating, 'age': delta.seconds, 'time': time, |