def import_entry(self, title, content, item_node):
try:<EOL><INDENT>creation_date = datetime.strptime(<EOL>item_node.find('<STR_LIT>' % WP_NS).text,<EOL>'<STR_LIT>')<EOL><DEDENT>except ValueError as error:<EOL><INDENT>print('<STR_LIT>'.format(error))<EOL>creation_date = datetime.now()<EOL><DEDENT>if settings.USE_TZ:<EOL><INDENT>creation_date = timezone.make_aware(<EOL>creation_date, pytz.timezone('<STR_LIT>'))<EOL><DEDENT>excerpt = strip_tags(item_node.find(<EOL>'<STR_LIT>' % WP_NS).text or '<STR_LIT>')<EOL>if not excerpt:<EOL><INDENT>if self.auto_excerpt:<EOL><INDENT>excerpt = Truncator(strip_tags(content)).words(<NUM_LIT:50>)<EOL><DEDENT>else:<EOL><INDENT>excerpt = '<STR_LIT>'<EOL><DEDENT><DEDENT>slug = slugify(title)[:<NUM_LIT:255>] or '<STR_LIT>' % item_node.find(<EOL>'<STR_LIT>' % WP_NS).text<EOL>entry_dict = {<EOL>'<STR_LIT:title>': title,<EOL>'<STR_LIT:content>': content,<EOL>'<STR_LIT>': excerpt,<EOL>'<STR_LIT>': '<STR_LIT:U+002CU+0020>'.join(self.get_entry_tags(item_node.findall(<EOL>'<STR_LIT>'))),<EOL>'<STR_LIT:status>': self.REVERSE_STATUS[item_node.find(<EOL>'<STR_LIT>' % WP_NS).text],<EOL>'<STR_LIT>': item_node.find(<EOL>'<STR_LIT>' % WP_NS).text == '<STR_LIT>',<EOL>'<STR_LIT>': item_node.find(<EOL>'<STR_LIT>' % WP_NS).text == '<STR_LIT>',<EOL>'<STR_LIT>': item_node.find('<STR_LIT>' % WP_NS).text == '<STR_LIT:1>',<EOL>'<STR_LIT:password>': item_node.find('<STR_LIT>' % WP_NS).text or '<STR_LIT>',<EOL>'<STR_LIT>': item_node.find(<EOL>'<STR_LIT>' % WP_NS).text == '<STR_LIT>',<EOL>'<STR_LIT>': timezone.now()}<EOL>entry_dict['<STR_LIT>'] = entry_dict['<STR_LIT>']<EOL>entry, created = Entry.objects.get_or_create(<EOL>slug=slug, creation_date=creation_date,<EOL>defaults=entry_dict)<EOL>if created:<EOL><INDENT>try:<EOL><INDENT>entry.categories.add(*self.get_entry_categories(<EOL>item_node.findall('<STR_LIT>')))<EOL>entry.authors.add(self.authors[item_node.find(<EOL>'<STR_LIT>').text])<EOL>entry.sites.add(self.SITE)<EOL><DEDENT>except KeyError as error:<EOL><INDENT>print('<STR_LIT>'.format(error))<EOL><DEDENT><DEDENT>return entry, created<EOL>
Importing an entry but some data are missing like
related entries, start_publication and end_publication.
start_publication and creation_date will use the same value,
wich is always in Wordpress $post->post_date.