##// END OF EJS Templates
Use singleton parser
neko259 -
r1499:a55d11eb default
parent child Browse files
Show More
@@ -237,3 +237,8 b' class Parser:'
237
237
238 def parse(self, text):
238 def parse(self, text):
239 return self.parser.format(text)
239 return self.parser.format(text)
240
241
242 parser = Parser()
243 def get_parser():
244 return parser
@@ -14,7 +14,7 b' from django.dispatch import receiver'
14
14
15 from boards import settings
15 from boards import settings
16 from boards.abstracts.tripcode import Tripcode
16 from boards.abstracts.tripcode import Tripcode
17 from boards.mdx_neboard import Parser
17 from boards.mdx_neboard import get_parser
18 from boards.models import PostImage, Attachment
18 from boards.models import PostImage, Attachment
19 from boards.models.base import Viewable
19 from boards.models.base import Viewable
20 from boards.models.post.export import get_exporter, DIFF_TYPE_JSON
20 from boards.models.post.export import get_exporter, DIFF_TYPE_JSON
@@ -376,4 +376,4 b' def connect_notifications(instance, **kw'
376
376
377 @receiver(pre_save, sender=Post)
377 @receiver(pre_save, sender=Post)
378 def preparse_text(instance, **kwargs):
378 def preparse_text(instance, **kwargs):
379 instance._text_rendered = Parser().parse(instance.get_raw_text())
379 instance._text_rendered = get_parser().parse(instance.get_raw_text())
General Comments 0
You need to be logged in to leave comments. Login now