equal
deleted
inserted
replaced
193 transaction.commit_unless_managed() |
193 transaction.commit_unless_managed() |
194 |
194 |
195 # Process comments. |
195 # Process comments. |
196 if soup.co_ment_text.comments: |
196 if soup.co_ment_text.comments: |
197 comments_ids_map = {} |
197 comments_ids_map = {} |
198 for imported_comment in soup.co_ment_text.comments.findAll('comment'): |
198 all_comments = soup.co_ment_text.comments.findAll('comment') |
|
199 # Sort by id in order to have parent processed before reply_to |
|
200 for imported_comment in sorted(all_comments, key=lambda cid: cid.id.renderContents()): |
199 # Creates each comment. |
201 # Creates each comment. |
200 comment = Comment.objects.create( |
202 comment = Comment.objects.create( |
201 text_version=text.get_latest_version(), |
203 text_version=text.get_latest_version(), |
202 title=imported_comment.title.renderContents(), |
204 title=imported_comment.title.renderContents(), |
203 state=imported_comment.state.renderContents(), |
205 state=imported_comment.state.renderContents(), |