5 class Meta(Node.Meta):
\r
6 ordering = ('-added_at',)
\r
9 def _update_parent_comment_count(self, diff):
\r
10 parent = self.parent
\r
11 parent.comment_count = parent.comment_count + diff
\r
19 def content_object(self):
\r
20 return self.parent.leaf
\r
22 def save(self, *args, **kwargs):
\r
23 super(Comment,self).save(*args, **kwargs)
\r
26 self._update_parent_comment_count(1)
\r
31 logging.debug('problem pinging google did you register you sitemap with google?')
\r
33 def mark_deleted(self, user):
\r
34 if super(Comment, self).mark_deleted(user):
\r
35 self._update_parent_comment_count(-1)
\r
37 def unmark_deleted(self):
\r
38 if super(Comment, self).unmark_deleted():
\r
39 self._update_parent_comment_count(1)
\r
41 def is_reply_to(self, user):
\r
42 inreply = re.search('@\w+', self.comment)
\r
43 if inreply is not None:
\r
44 return user.username.startswith(inreply.group(0))
\r
48 def __unicode__(self):
\r