def import_comments(self, entry, comment_nodes):
for comment_node in comment_nodes:<EOL><INDENT>is_pingback = comment_node.find(<EOL>'<STR_LIT>' % WP_NS).text == PINGBACK<EOL>is_trackback = comment_node.find(<EOL>'<STR_LIT>' % WP_NS).text == TRACKBACK<EOL>title = '<STR_LIT>' % (comment_node.find(<EOL>'<STR_LIT>' % WP_NS).text)<EOL>self.write_out('<STR_LIT>' % title)<EOL>content = comment_node.find(<EOL>'<STR_LIT>' % WP_NS).text<EOL>if not content:<EOL><INDENT>self.write_out(self.style.NOTICE('<STR_LIT>'))<EOL>return<EOL><DEDENT>submit_date = datetime.strptime(<EOL>comment_node.find('<STR_LIT>' % WP_NS).text,<EOL>'<STR_LIT>')<EOL>if settings.USE_TZ:<EOL><INDENT>submit_date = timezone.make_aware(submit_date,<EOL>pytz.timezone('<STR_LIT>'))<EOL><DEDENT>approvation = comment_node.find(<EOL>'<STR_LIT>' % WP_NS).text<EOL>is_public = True<EOL>is_removed = False<EOL>if approvation != '<STR_LIT:1>':<EOL><INDENT>is_removed = True<EOL><DEDENT>if approvation == '<STR_LIT>':<EOL><INDENT>is_public = False<EOL><DEDENT>comment_dict = {<EOL>'<STR_LIT>': entry,<EOL>'<STR_LIT>': self.SITE,<EOL>'<STR_LIT>': comment_node.find(<EOL>'<STR_LIT>' % WP_NS).text[:<NUM_LIT:50>],<EOL>'<STR_LIT>': comment_node.find(<EOL>'<STR_LIT>' % WP_NS).text or '<STR_LIT>',<EOL>'<STR_LIT>': comment_node.find(<EOL>'<STR_LIT>' % WP_NS).text or '<STR_LIT>',<EOL>'<STR_LIT>': content,<EOL>'<STR_LIT>': submit_date,<EOL>'<STR_LIT>': comment_node.find(<EOL>'<STR_LIT>' % WP_NS).text or None,<EOL>'<STR_LIT>': is_public,<EOL>'<STR_LIT>': is_removed, }<EOL>comment = comments.get_model()(**comment_dict)<EOL>comment.save()<EOL>if is_pingback:<EOL><INDENT>comment.flags.create(<EOL>user=get_user_flagger(), flag=PINGBACK)<EOL><DEDENT>if is_trackback:<EOL><INDENT>comment.flags.create(<EOL>user=get_user_flagger(), flag=TRACKBACK)<EOL><DEDENT>self.write_out(self.style.ITEM('<STR_LIT>'))<EOL><DEDENT>entry.comment_count = entry.comments.count()<EOL>entry.pingback_count = entry.pingbacks.count()<EOL>entry.trackback_count = entry.trackbacks.count()<EOL>entry.save(force_update=True)<EOL>
Loops over comments nodes and import then
in django_comments.