Show More
@@ -54,6 +54,7 b" DIFF_TYPE_JSON = 'json'" | |||||
54 | PREPARSE_PATTERNS = { |
|
54 | PREPARSE_PATTERNS = { | |
55 | r'>>(\d+)': r'[post]\1[/post]', # Reflink ">>123" |
|
55 | r'>>(\d+)': r'[post]\1[/post]', # Reflink ">>123" | |
56 | r'^>(.+)': r'[quote]\1[/quote]', # Quote ">text" |
|
56 | r'^>(.+)': r'[quote]\1[/quote]', # Quote ">text" | |
|
57 | r'^//(.+)': r'[comment]\1[/comment]', # Comment "//text" | |||
57 | } |
|
58 | } | |
58 |
|
59 | |||
59 |
|
60 | |||
@@ -88,8 +89,8 b' class PostManager(models.Manager):' | |||||
88 |
|
89 | |||
89 | logger = logging.getLogger('boards.post.create') |
|
90 | logger = logging.getLogger('boards.post.create') | |
90 |
|
91 | |||
91 |
logger.info('Created post |
|
92 | logger.info('Created post {} by {}'.format( | |
92 |
post |
|
93 | post, post.poster_ip)) | |
93 |
|
94 | |||
94 | if image: |
|
95 | if image: | |
95 | post_image = PostImage.objects.create(image=image) |
|
96 | post_image = PostImage.objects.create(image=image) | |
@@ -367,7 +368,7 b' class Post(models.Model, Viewable):' | |||||
367 | super(Post, self).delete(using) |
|
368 | super(Post, self).delete(using) | |
368 |
|
369 | |||
369 | logging.getLogger('boards.post.delete').info( |
|
370 | logging.getLogger('boards.post.delete').info( | |
370 |
'Deleted post |
|
371 | 'Deleted post {}'.format(self)) | |
371 |
|
372 | |||
372 | def get_post_data(self, format_type=DIFF_TYPE_JSON, request=None, |
|
373 | def get_post_data(self, format_type=DIFF_TYPE_JSON, request=None, | |
373 | include_last_update=False): |
|
374 | include_last_update=False): |
@@ -9,4 +9,11 b' class ParserTest(TestCase):' | |||||
9 |
|
9 | |||
10 | self.assertEqual( |
|
10 | self.assertEqual( | |
11 | '[quote]quote[/quote]\nQuote in >line\nLine\n[quote]Quote[/quote]', |
|
11 | '[quote]quote[/quote]\nQuote in >line\nLine\n[quote]Quote[/quote]', | |
12 | preparsed_text, 'Quote not preparsed.') No newline at end of file |
|
12 | preparsed_text, 'Quote not preparsed.') | |
|
13 | ||||
|
14 | def test_preparse_comment(self): | |||
|
15 | raw_text = '//comment' | |||
|
16 | preparsed_text = Post.objects._preparse_text(raw_text) | |||
|
17 | ||||
|
18 | self.assertEqual('[comment]comment[/comment]', preparsed_text, | |||
|
19 | 'Comment not preparsed.') |
General Comments 0
You need to be logged in to leave comments.
Login now