Skip to content
Browse files

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)
  • Loading branch information...
1 parent 66fbff0 commit 61e38775bcf8754d7d25c7b3ca5ea8a1666a1787 Jonas Obrist committed Aug 29, 2011
Showing with 5 additions and 0 deletions.
  1. +5 −0 cms/plugin_pool.py
View
5 cms/plugin_pool.py
@@ -6,6 +6,7 @@
from cms.utils.placeholder import get_placeholder_conf
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
+import warnings
class PluginPool(object):
def __init__(self):
@@ -25,8 +26,10 @@ def register_plugin(self, plugin):
If a plugin is already registered, this will raise PluginAlreadyRegistered.
"""
if hasattr(plugin,'__iter__'):
+ warnings.warn("Registering more than one plugin at once will be deprecated in 2.3", DeprecationWarning)
for single_plugin in plugin:
self.register_plugin(single_plugin)
+ return
if not issubclass(plugin, CMSPluginBase):
raise ImproperlyConfigured(
"CMS Plugins must be subclasses of CMSPluginBase, %r is not."
@@ -58,8 +61,10 @@ def unregister_plugin(self, plugin):
If a plugin isn't already registered, this will raise PluginNotRegistered.
"""
if hasattr(plugin,'__iter__'):
+ warnings.warn("Unregistering more than one plugin at once will be deprecated in 2.3", DeprecationWarning)
for single_plugin in plugin:
self.unregister_plugin(single_plugin)
+ return
plugin_name = plugin.__name__
if plugin_name not in self.plugins:
raise PluginNotRegistered(

0 comments on commit 61e3877

Please sign in to comment.
Something went wrong with that request. Please try again.