Skip to content
This repository

Fixed plugin_pool.register_plugin with a list of plugins #969

Merged
merged 1 commit into from almost 3 years ago

2 participants

Jonas Obrist Chris Glass
Jonas Obrist
Collaborator
ojii commented

added a deprecation warning. registering lists will be removed in 2.3 (because there should be one way to do it)

Jonas Obrist ojii Fixed plugin_pool.register_plugin with a list of plugins
added a deprecation warning. registering lists will be removed in 2.3 (because there should be one way to do it)
61e3877
Chris Glass
Collaborator

LGTM. Merging...

Chris Glass chrisglass merged commit aaa32ec into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Aug 29, 2011
Jonas Obrist ojii Fixed plugin_pool.register_plugin with a list of plugins
added a deprecation warning. registering lists will be removed in 2.3 (because there should be one way to do it)
61e3877
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 5 additions and 0 deletions. Show diff stats Hide diff stats

  1. +5 0 cms/plugin_pool.py
5 cms/plugin_pool.py
@@ -6,6 +6,7 @@
6 6 from cms.utils.placeholder import get_placeholder_conf
7 7 from django.conf import settings
8 8 from django.core.exceptions import ImproperlyConfigured
  9 +import warnings
9 10
10 11 class PluginPool(object):
11 12 def __init__(self):
@@ -25,8 +26,10 @@ def register_plugin(self, plugin):
25 26 If a plugin is already registered, this will raise PluginAlreadyRegistered.
26 27 """
27 28 if hasattr(plugin,'__iter__'):
  29 + warnings.warn("Registering more than one plugin at once will be deprecated in 2.3", DeprecationWarning)
28 30 for single_plugin in plugin:
29 31 self.register_plugin(single_plugin)
  32 + return
30 33 if not issubclass(plugin, CMSPluginBase):
31 34 raise ImproperlyConfigured(
32 35 "CMS Plugins must be subclasses of CMSPluginBase, %r is not."
@@ -58,8 +61,10 @@ def unregister_plugin(self, plugin):
58 61 If a plugin isn't already registered, this will raise PluginNotRegistered.
59 62 """
60 63 if hasattr(plugin,'__iter__'):
  64 + warnings.warn("Unregistering more than one plugin at once will be deprecated in 2.3", DeprecationWarning)
61 65 for single_plugin in plugin:
62 66 self.unregister_plugin(single_plugin)
  67 + return
63 68 plugin_name = plugin.__name__
64 69 if plugin_name not in self.plugins:
65 70 raise PluginNotRegistered(

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.