##// END OF EJS Templates
Parse tripcode for post sync
neko259 -
r1557:68d42ef1 default
parent child Browse files
Show More
@@ -129,7 +129,8 b' class PostManager(models.Manager):'
129
129
130 @transaction.atomic
130 @transaction.atomic
131 def import_post(self, title: str, text: str, pub_time: str, global_id,
131 def import_post(self, title: str, text: str, pub_time: str, global_id,
132 opening_post=None, tags=list(), files=list()):
132 opening_post=None, tags=list(), files=list(),
133 tripcode=None):
133 is_opening = opening_post is None
134 is_opening = opening_post is None
134 if is_opening:
135 if is_opening:
135 thread = boards.models.thread.Thread.objects.create(
136 thread = boards.models.thread.Thread.objects.create(
@@ -144,7 +145,7 b' class PostManager(models.Manager):'
144 last_edit_time=pub_time,
145 last_edit_time=pub_time,
145 global_id=global_id,
146 global_id=global_id,
146 opening=is_opening,
147 opening=is_opening,
147 thread=thread)
148 thread=thread, tripcode=tripcode)
148
149
149 # TODO Add files
150 # TODO Add files
150 for file in files:
151 for file in files:
@@ -177,6 +177,7 b' class SyncManager:'
177 title = tag_content.find(TAG_TITLE).text or ''
177 title = tag_content.find(TAG_TITLE).text or ''
178 text = tag_content.find(TAG_TEXT).text or ''
178 text = tag_content.find(TAG_TEXT).text or ''
179 pub_time = tag_content.find(TAG_PUB_TIME).text
179 pub_time = tag_content.find(TAG_PUB_TIME).text
180 tripcode = tag_content.find(TAG_TRIPCODE).text
180
181
181 thread = tag_content.find(TAG_THREAD)
182 thread = tag_content.find(TAG_THREAD)
182 tags = []
183 tags = []
@@ -218,7 +219,7 b' class SyncManager:'
218 Post.objects.import_post(
219 Post.objects.import_post(
219 title=title, text=text, pub_time=pub_time,
220 title=title, text=text, pub_time=pub_time,
220 opening_post=opening_post, tags=tags,
221 opening_post=opening_post, tags=tags,
221 global_id=global_id, files=files)
222 global_id=global_id, files=files, tripcode=tripcode)
222 else:
223 else:
223 raise SyncException(EXCEPTION_NODE.format(tag_status.text))
224 raise SyncException(EXCEPTION_NODE.format(tag_status.text))
224
225
General Comments 0
You need to be logged in to leave comments. Login now