##// END OF EJS Templates
Another word for 'all threads'
Another word for 'all threads'

File last commit:

r1633:02bb1251 default
r1734:0f5e5df4 default
Show More
posting_mixin.py
24 lines | 612 B | text/x-python | PythonLexer
neko259
Rewriting views to class-based
r542 import re
from boards.models import Post
from boards.models.post import REGEX_REPLY
REFLINK_PREFIX = '>>'
class PostMixin:
@staticmethod
def _remove_invalid_links(text):
"""
Replace invalid links in posts so that they won't be parsed.
Invalid links are links to non-existent posts
"""
for reply_number in re.finditer(REGEX_REPLY, text):
post_id = reply_number.group(1)
post = Post.objects.filter(id=post_id)
if not post.exists():
neko259
Attempt to fix the string replace problem
r1633 text = text.replace(REFLINK_PREFIX + post_id, post_id)
neko259
Rewriting views to class-based
r542
return text