from base import *\r
+from django.utils.translation import ugettext as _\r
import re\r
\r
class Comment(Node):\r
+ friendly_name = _("comment")\r
+\r
class Meta(Node.Meta):\r
ordering = ('-added_at',)\r
proxy = True\r
\r
@property\r
def comment(self):\r
- return self.body\r
+ if settings.FORM_ALLOW_MARKDOWN_IN_COMMENTS:\r
+ return self.as_markdown('limitedsyntax')\r
+ else:\r
+ return self.body\r
\r
@property\r
def headline(self):\r
def save(self, *args, **kwargs):\r
super(Comment,self).save(*args, **kwargs)\r
\r
- if self._is_new:\r
- self._update_parent_comment_count(1)\r
-\r
- try:\r
- ping_google()\r
- except Exception:\r
- logging.debug('problem pinging google did you register you sitemap with google?')\r
+ if not self.id:\r
+ self.parent.reset_comment_count_cache()\r
\r
def mark_deleted(self, user):\r
if super(Comment, self).mark_deleted(user):\r
- self._update_parent_comment_count(-1)\r
+ self.parent.reset_comment_count_cache()\r
\r
def unmark_deleted(self):\r
if super(Comment, self).unmark_deleted():\r
- self._update_parent_comment_count(1)\r
+ self.parent.reset_comment_count_cache()\r
\r
def is_reply_to(self, user):\r
inreply = re.search('@\w+', self.body)\r
return False\r
\r
def get_absolute_url(self):\r
- return self.absolute_parent.get_absolute_url() + "#%d" % self.id\r
+ return self.abs_parent.get_absolute_url() + "#%d" % self.id\r
\r
def __unicode__(self):\r
return self.body\r