Mercurial > piecrust2
comparison piecrust/importing/wordpress.py @ 314:1ddd18ad5e76
import: Wordpress importer puts drafts in a `draft` folder. Ignore other statuses.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 27 Mar 2015 20:46:36 -0700 |
parents | 103abb08755e |
children | dd25bd3ce1f9 |
comparison
equal
deleted
inserted
replaced
313:9188b362069e | 314:1ddd18ad5e76 |
---|---|
125 excerpt = post_info['excerpt'] | 125 excerpt = post_info['excerpt'] |
126 text = content | 126 text = content |
127 if excerpt is not None and excerpt.strip() != '': | 127 if excerpt is not None and excerpt.strip() != '': |
128 text = "%s\n\n---excerpt---\n\n%s" % (content, excerpt) | 128 text = "%s\n\n---excerpt---\n\n%s" % (content, excerpt) |
129 | 129 |
130 path = source.resolveRef(rel_path) | 130 status = metadata.get('status') |
131 create_page(self.app, path, metadata, text) | 131 if status == 'publish': |
132 path = source.resolveRef(rel_path) | |
133 create_page(self.app, path, metadata, text) | |
134 elif status == 'draft': | |
135 filename = '-'.join(metadata['title'].split(' ')) + '.html' | |
136 path = os.path.join(self.app.root_dir, 'drafts', filename) | |
137 create_page(self.app, path, metadata, text) | |
138 else: | |
139 logger.warning("Ignoring post with status: %s" % status) | |
132 | 140 |
133 | 141 |
134 class _XmlImporter(_ImporterBase): | 142 class _XmlImporter(_ImporterBase): |
135 ns_wp = {'wp': 'http://wordpress.org/export/1.2/'} | 143 ns_wp = {'wp': 'http://wordpress.org/export/1.2/'} |
136 ns_dc = {'dc': "http://purl.org/dc/elements/1.1/"} | 144 ns_dc = {'dc': "http://purl.org/dc/elements/1.1/"} |