diff --git a/boards/models/post.py b/boards/models/post.py --- a/boards/models/post.py +++ b/boards/models/post.py @@ -54,6 +54,7 @@ DIFF_TYPE_JSON = 'json' PREPARSE_PATTERNS = { r'>>(\d+)': r'[post]\1[/post]', # Reflink ">>123" r'^>(.+)': r'[quote]\1[/quote]', # Quote ">text" + r'^//(.+)': r'[comment]\1[/comment]', # Comment "//text" } @@ -88,8 +89,8 @@ class PostManager(models.Manager): logger = logging.getLogger('boards.post.create') - logger.info('Created post #{} with title "{}" by {}'.format( - post.id, post.title, post.poster_ip)) + logger.info('Created post {} by {}'.format( + post, post.poster_ip)) if image: post_image = PostImage.objects.create(image=image) @@ -367,7 +368,7 @@ class Post(models.Model, Viewable): super(Post, self).delete(using) logging.getLogger('boards.post.delete').info( - 'Deleted post P#{}/{}'.format(self.id, self.get_title())) + 'Deleted post {}'.format(self)) def get_post_data(self, format_type=DIFF_TYPE_JSON, request=None, include_last_update=False): diff --git a/boards/tests/test_parser.py b/boards/tests/test_parser.py --- a/boards/tests/test_parser.py +++ b/boards/tests/test_parser.py @@ -9,4 +9,11 @@ class ParserTest(TestCase): self.assertEqual( '[quote]quote[/quote]\nQuote in >line\nLine\n[quote]Quote[/quote]', - preparsed_text, 'Quote not preparsed.') \ No newline at end of file + preparsed_text, 'Quote not preparsed.') + + def test_preparse_comment(self): + raw_text = '//comment' + preparsed_text = Post.objects._preparse_text(raw_text) + + self.assertEqual('[comment]comment[/comment]', preparsed_text, + 'Comment not preparsed.')