Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

cleanup and circular errors removed

  • Loading branch information...
commit 111d80601fd501fdfc953144e3a386b0a0910356 1 parent 8197993
@digi604 authored
View
2  cms/middleware/toolbar.py
@@ -13,11 +13,9 @@ def toolbar_plugin_processor(instance, placeholder, rendered_content, original_c
child_plugin_classes = []
if instance.get_plugin_class().allow_children:
instance, plugin = instance.get_plugin_instance()
- print plugin
for child_class_name in plugin.get_child_classes(placeholder, original_context.get('request', {}).current_page):
cls = plugin_pool.get_plugin(child_class_name)
child_plugin_classes.append((cls.__name__, unicode(cls.name)))
- print child_plugin_classes
data = {
'instance': instance,
'rendered_content': rendered_content,
View
5 cms/models/pluginmodel.py
@@ -129,8 +129,8 @@ def __reduce__(self):
factory = simple_class_factory
return (model_unpickle, (model, defers, factory), data)
- def __unicode__(self):
- return unicode(self.id)
+ #def __unicode__(self):
+ # return unicode(self.id)
def get_plugin_name(self):
from cms.plugin_pool import plugin_pool
@@ -163,7 +163,6 @@ def get_plugin_instance(self, admin=None):
return instance, plugin
def render_plugin(self, context=None, placeholder=None, admin=False, processors=None):
- print "model render plugin", self.__class__
instance, plugin = self.get_plugin_instance()
if instance and not (admin and not plugin.admin_preview):
if not isinstance(placeholder, Placeholder):
View
12 cms/plugin_rendering.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from cms.models.placeholdermodel import Placeholder
-from cms.plugin_processors import (plugin_meta_context_processor,
+from cms.plugin_processors import (plugin_meta_context_processor,
mark_safe_plugin_processor)
from cms.utils import get_language_from_request
from cms.utils.django_load import iterload_objects
@@ -39,7 +39,7 @@ def __init__(self, dict, instance, placeholder, processors=None, current_app=Non
self.update(processor(instance, placeholder))
for processor in processors:
self.update(processor(instance, placeholder))
-
+
def render_plugin(context, instance, placeholder, template, processors=None,
current_app=None):
"""
@@ -74,7 +74,7 @@ def render_plugins(plugins, context, placeholder, processors=None):
out = []
total = len(plugins)
for index, plugin in enumerate(plugins):
- plugin._render_meta.total = total
+ plugin._render_meta.total = total
plugin._render_meta.index = index
context.push()
out.append(plugin.render_plugin(context, placeholder, processors=processors))
@@ -87,7 +87,7 @@ def render_placeholder(placeholder, context_to_copy, name_fallback="Placeholder"
given context, and returns a string containing the rendered output.
"""
from cms.plugins.utils import get_plugins
- context = context_to_copy
+ context = context_to_copy
context.push()
request = context['request']
plugins = [plugin for plugin in get_plugins(request, placeholder)]
@@ -113,7 +113,7 @@ def render_placeholder(placeholder, context_to_copy, name_fallback="Placeholder"
# Prepend frontedit toolbar output if applicable
edit = False
toolbar = getattr(request, 'toolbar', None)
-
+
if (getattr(toolbar, 'edit_mode', False) and
(not page or page.has_change_permission(request))):
edit = True
@@ -121,7 +121,7 @@ def render_placeholder(placeholder, context_to_copy, name_fallback="Placeholder"
from cms.middleware.toolbar import toolbar_plugin_processor
processors = (toolbar_plugin_processor,)
else:
- processors = None
+ processors = None
content.extend(render_plugins(plugins, context, placeholder, processors))
content = "".join(content)
View
1  cms/plugins/column/cms_plugins.py
@@ -25,7 +25,6 @@ class ColumnPlugin(CMSPluginBase):
allow_children = True
def render(self, context, instance, placeholder):
- print "column render"
context.update({
'instance': instance,
'placeholder':placeholder,
View
12 cms/plugins/picture/cms_plugins.py
@@ -7,9 +7,9 @@
class PicturePlugin(CMSPluginBase):
model = Picture
name = _("Picture")
- render_template = "cms/plugins/column.html"
+ render_template = "cms/plugins/picture.html"
text_enabled = True
-
+
def render(self, context, instance, placeholder):
if instance.url:
link = instance.url
@@ -19,13 +19,13 @@ def render(self, context, instance, placeholder):
link = ""
context.update({
'picture': instance,
- 'link': link,
+ 'link': link,
'placeholder': placeholder
})
- return context
-
+ return context
+
def icon_src(self, instance):
# TODO - possibly use 'instance' and provide a thumbnail image
return settings.STATIC_URL + u"cms/images/plugins/image.png"
-
+
plugin_pool.register_plugin(PicturePlugin)
View
15 cms/plugins/utils.py
@@ -35,7 +35,7 @@ def assign_plugins(request, placeholders, lang=None):
request_lang = fallback
break
# get all plugins for the given placeholders
- qs = get_cmsplugin_queryset(request).filter(placeholder__in=placeholders, language=request_lang).order_by('placeholder','tree_id', 'lft')
+ qs = get_cmsplugin_queryset(request).filter(placeholder__in=placeholders, language=request_lang).order_by('placeholder', 'tree_id', 'lft')
plugin_list = downcast_plugins(qs)
# split the plugins up by placeholder
@@ -64,19 +64,8 @@ def build_plugin_tree(plugin_list):
break
last = plugin
root.sort(key=lambda x: x.position)
- print root
- print_node(root, 0)
return root
-def print_node(nodes, level):
- for n in nodes:
- print level*" ",n.__class__
- if n.childrens:
- print_node(n.childrens, level+2)
- else:
- print level*" ",[]
-
-
def downcast_plugins(queryset, select_placeholder=False):
plugin_types_map = defaultdict(list)
plugin_lookup = {}
@@ -105,7 +94,7 @@ def get_plugins_for_page(request, page, lang=None):
return []
lang = lang or get_language_from_request(request)
if not hasattr(page, '_%s_plugins_cache' % lang):
- setattr(page, '_%s_plugins_cache' % lang, get_cmsplugin_queryset(request).filter(
+ setattr(page, '_%s_plugins_cache' % lang, get_cmsplugin_queryset(request).filter(
placeholder__page=page, language=lang, parent__isnull=True
).order_by('placeholder', 'position').select_related())
return getattr(page, '_%s_plugins_cache' % lang)
View
5 cms/templatetags/cms_tags.py
@@ -259,11 +259,6 @@ class RenderPlugin(InclusionTag):
)
def get_context(self, context, plugin):
- print "++++++++++++++++++++++ render plugin ttag"
- print plugin
- print plugin.childrens
- print plugin.__class__
-
# Prepend frontedit toolbar output if applicable
edit = False
request = context['request']
Please sign in to comment.
Something went wrong with that request. Please try again.