Skip to content

Commit

Permalink
Revert "Trying to de-duplicate code."
Browse files Browse the repository at this point in the history
This reverts commit ceda8e9.
  • Loading branch information
Kwpolska committed Jul 5, 2015
1 parent ceda8e9 commit c9e6d8c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions nikola/nikola.py
Expand Up @@ -831,6 +831,7 @@ def __init__(self, **config):

def _activate_plugins_of_category(self, category):
"""Activate all the plugins of a given category and return them."""
# this code duplicated in tests/base.py
plugins = []
for plugin_info in self.plugin_manager.getPluginsOfCategory(category):
if plugin_info.name in self.config.get('DISABLED_PLUGINS'):
Expand Down
14 changes: 12 additions & 2 deletions tests/base.py
Expand Up @@ -34,7 +34,6 @@
MarkdownExtension,
RestExtension
)
import nikola


if sys.version_info < (2, 7):
Expand Down Expand Up @@ -243,7 +242,18 @@ def __init__(self):
self.template_system = self
self.name = 'mako'

_activate_plugins_of_category = nikola.Nikola._activate_plugins_of_category
def _activate_plugins_of_category(self, category):
"""Activate all the plugins of a given category and return them."""
# this code duplicated in nikola/nikola.py
plugins = []
for plugin_info in self.plugin_manager.getPluginsOfCategory(category):
if plugin_info.name in self.config.get('DISABLED_PLUGINS'):
self.plugin_manager.removePluginFromCategory(plugin_info, category)
else:
self.plugin_manager.activatePluginByName(plugin_info.name)
plugin_info.plugin_object.set_site(self)
plugins.append(plugin_info)
return plugins

def render_template(self, name, _, context):
return('<img src="IMG.jpg">')

0 comments on commit c9e6d8c

Please sign in to comment.