Show More
@@ -170,9 +170,8 b' class PostManager(models.Manager):' | |||
|
170 | 170 | Connects replies to a post to show them as a reflink map |
|
171 | 171 | """ |
|
172 | 172 | |
|
173 |
for reply_number in |
|
|
174 |
post |
|
|
175 | ref_post = self.filter(id=post_id) | |
|
173 | for reply_number in post.get_replied_ids(): | |
|
174 | ref_post = self.filter(id=reply_number) | |
|
176 | 175 | if ref_post.count() > 0: |
|
177 | 176 | referenced_post = ref_post[0] |
|
178 | 177 | referenced_post.referenced_posts.add(post) |
@@ -234,7 +233,7 b' class PostManager(models.Manager):' | |||
|
234 | 233 | |
|
235 | 234 | text = et.SubElement(content_tag, TAG_TEXT) |
|
236 | 235 | # TODO Replace local links by global ones in the text |
|
237 |
text.text = post. |
|
|
236 | text.text = post.get_raw_text() | |
|
238 | 237 | |
|
239 | 238 | if not post.is_opening(): |
|
240 | 239 | thread = et.SubElement(content_tag, TAG_THREAD) |
@@ -523,17 +522,16 b' class Post(models.Model, Viewable):' | |||
|
523 | 522 | def get_pub_time_epoch(self): |
|
524 | 523 | return utils.datetime_to_epoch(self.pub_time) |
|
525 | 524 | |
|
526 | # TODO Use this to connect replies | |
|
527 | 525 | def get_replied_ids(self): |
|
528 | 526 | """ |
|
529 | 527 | Gets ID list of the posts that this post replies. |
|
530 | 528 | """ |
|
531 | 529 | |
|
532 | local_replied = REGEX_REPLY.findall(self.text.raw) | |
|
530 | raw_text = self.get_raw_text() | |
|
531 | ||
|
532 | local_replied = REGEX_REPLY.findall(raw_text) | |
|
533 | 533 | global_replied = [] |
|
534 | # TODO Similar code is used in mdx_neboard, maybe it can be extracted | |
|
535 | # into a method? | |
|
536 | for match in REGEX_GLOBAL_REPLY.findall(self.text.raw): | |
|
534 | for match in REGEX_GLOBAL_REPLY.findall(raw_text): | |
|
537 | 535 | key_type = match[0] |
|
538 | 536 | key = match[1] |
|
539 | 537 | local_id = match[2] |
@@ -42,7 +42,7 b' class SyncTest(TestCase):' | |||
|
42 | 42 | post.id, |
|
43 | 43 | post.global_id.key_type, |
|
44 | 44 | post.title, |
|
45 |
post. |
|
|
45 | post.get_raw_text(), | |
|
46 | 46 | post.get_pub_time_epoch(), |
|
47 | 47 | ) in respond_get(request).content.decode(), |
|
48 | 'Wrong response generated for the GET request.') No newline at end of file | |
|
48 | 'Wrong response generated for the GET request.') |
General Comments 0
You need to be logged in to leave comments.
Login now