Example #1
0
def setup():
    """
    Gather all checks and validations
    """
    from cms.plugin_pool import plugin_pool
    plugin_pool.set_plugin_meta()
    validate_dependencies()
    validate_settings()
    plugin_pool.validate_templates()
Example #2
0
def _verify_plugin_type(plugin_type):
    """
    Verifies the given plugin_type is valid and returns a tuple of
    (plugin_model, plugin_type)
    """
    if (hasattr(plugin_type, '__module__') and
        issubclass(plugin_type, CMSPluginBase)):
        plugin_pool.set_plugin_meta()
        plugin_model = plugin_type.model
        assert plugin_type in plugin_pool.plugins.values()
        plugin_type = plugin_type.__name__
    elif isinstance(plugin_type, string_types):
        try:
            plugin_model = plugin_pool.get_plugin(plugin_type).model
        except KeyError:
            raise TypeError(
                'plugin_type must be CMSPluginBase subclass or string'
            )
    else:
        raise TypeError('plugin_type must be CMSPluginBase subclass or string')
    return plugin_model, plugin_type
Example #3
0
def setup():
    """
    Gather all checks and validations
    """
    from cms.plugin_pool import plugin_pool
    if DJANGO_1_6:
        # While setup is called both in all the Django versions only 1.6-
        # requires paching the AppCache. 1.7 provides a cleaner way to handle
        # this in AppConfig and thus the patching is left for older version only
        from django.db.models import loading
        old_get_models = loading.AppCache.get_models

        def get_models_patched(self, **kwargs):
            ret_value = old_get_models(self, **kwargs)
            plugin_pool.set_plugin_meta()
            return ret_value

        loading.AppCache.get_models = get_models_patched
    else:
        plugin_pool.set_plugin_meta()
    validate_dependencies()
    validate_settings()
    plugin_pool.validate_templates()
Example #4
0
 def tearDown(self):
     plugin_pool.patched = False
     plugin_pool.set_plugin_meta()
Example #5
0
 def get_models_patched(self, **kwargs):
     ret_value = old_get_models(self, **kwargs)
     from cms.plugin_pool import plugin_pool
     plugin_pool.set_plugin_meta()
     return ret_value
Example #6
0
 def get_models_patched(self, **kwargs):
     ret_value = old_get_models(self, **kwargs)
     plugin_pool.set_plugin_meta()
     return ret_value
Example #7
0
 def ready(self):
     setup()
     from cms.plugin_pool import plugin_pool
     plugin_pool.set_plugin_meta()
Example #8
0
 def get_models_patched(self, app_mod=None, include_auto_created=False,
                        include_deferred=False, only_installed=True):
     loading.AppCache.get_models(self, app_mod, include_auto_created,
                                 include_deferred, only_installed)
     from cms.plugin_pool import plugin_pool
     plugin_pool.set_plugin_meta()
Example #9
0
 def tearDown(self):
     plugin_pool.patched = False
     plugin_pool.set_plugin_meta()