##// END OF EJS Templates
Convert \r\n and \r to \n in the post text used in sync
neko259 -
r1504:ce9e0d38 decentral
parent child Browse files
Show More
@@ -377,6 +377,7 b' class Post(models.Model, Viewable):'
377 377 for key in replacements:
378 378 text = text.replace('[post]{}[/post]'.format(key),
379 379 '[post]{}[/post]'.format(replacements[key]))
380 text = text.replace('\r\n', '\n').replace('\r', '\n')
380 381
381 382 return text
382 383
@@ -87,7 +87,7 b' class SyncManager:'
87 87 signature = Signature(
88 88 key_type=key.key_type,
89 89 key=key.public_key,
90 signature=key.sign(et.tostring(content_tag, ENCODING_UNICODE)),
90 signature=key.sign(et.tostring(content_tag, encoding=ENCODING_UNICODE)),
91 91 global_id=post.global_id,
92 92 )
93 93 signature.save()
@@ -17,7 +17,8 b' class SyncTest(TestCase):'
17 17
18 18 key = KeyPair.objects.generate_key(primary=True)
19 19 tag = Tag.objects.create(name='tag1')
20 post = Post.objects.create_post(title='test_title', text='test_text',
20 post = Post.objects.create_post(title='test_title',
21 text='test_text\rline two',
21 22 tags=[tag])
22 23
23 24 request = MockRequest()
@@ -47,7 +48,7 b' class SyncTest(TestCase):'
47 48 post.global_id.local_id,
48 49 post.global_id.key_type,
49 50 post.title,
50 post.get_raw_text(),
51 post.get_sync_text(),
51 52 post.get_thread().get_tags().first().name,
52 53 post.get_pub_time_str(),
53 54 ) in response,
@@ -94,7 +95,7 b' class SyncTest(TestCase):'
94 95 post.global_id.local_id,
95 96 post.global_id.key_type,
96 97 post.title,
97 post.get_raw_text(),
98 post.get_sync_text(),
98 99 post.get_thread().get_tags().first().name,
99 100 post.get_pub_time_str(),
100 101 ) in response,
General Comments 0
You need to be logged in to leave comments. Login now