Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6a1813b

Browse files
committedJul 12, 2015
Optimizing WordPress plugin finding.
1 parent 220d27b commit 6a1813b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed
 

Diff for: ‎nikola/plugins/command/import_wordpress.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,14 @@ class CommandImportWordpress(Command, ImportMixin):
180180
all_tags = set([])
181181

182182
def _find_wordpress_compiler(self):
183-
for plugin_info in self.site.plugin_manager.getPluginsOfCategory('PageCompiler'):
184-
if plugin_info.name == 'wordpress':
185-
if not plugin_info.is_activated:
186-
self.site.plugin_manager.activatePluginByName(plugin_info.name)
187-
plugin_info.plugin_object.set_site(self.site)
188-
self.wordpress_page_compiler = plugin_info.plugin_object
189-
break
183+
if self.wordpress_page_compiler is not None:
184+
return
185+
plugin_info = self.site.plugin_manager.getPluginByName('wordpress', 'PageCompiler')
186+
if plugin_info is not None:
187+
if not plugin_info.is_activated:
188+
self.site.plugin_manager.activatePluginByName(plugin_info.name)
189+
plugin_info.plugin_object.set_site(self.site)
190+
self.wordpress_page_compiler = plugin_info.plugin_object
190191

191192
def _read_options(self, options, args):
192193
options['filename'] = args.pop(0)

0 commit comments

Comments
 (0)
Please sign in to comment.