Changeset 1283
- Timestamp:
- 10/23/07 13:12:39 (21 months ago)
- Location:
- trunk/pylucid/PyLucid
- Files:
-
- 5 modified
-
defaulttags/lucidTag.py (modified) (3 diffs)
-
index.py (modified) (2 diffs)
-
settings_example.py (modified) (1 diff)
-
system/context_processors.py (modified) (2 diffs)
-
tools/content_processors.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pylucid/PyLucid/defaulttags/lucidTag.py
r1264 r1283 25 25 from PyLucid.system.plugin_manager import run 26 26 from PyLucid.system.response import SimpleStringIO 27 from PyLucid. tools.shortcuts import makeUnique27 from PyLucid.system.context_processors import add_css_tag 28 28 29 29 from django.conf import settings … … 62 62 ) 63 63 64 def _add_unique_div(self, context, content):65 """66 Add a html DIV tag with a unique CSS-ID and a class name defined in67 the settings.py68 """69 id = self.plugin_name + "_" + self.method_name70 id = makeUnique(id, context["CSS_ID_list"])71 context["CSS_ID_list"].append(id)72 73 try:74 return u'<div class="%s %s" id="%s">\n%s\n</div>\n' % (75 settings.CSS_DIV_CLASS_NAME, self.plugin_name, id, content76 )77 except UnicodeDecodeError:78 # FIXME: In some case (with mysql_old) we have trouble here.79 # I get this traceback on www.jensdiemer.de like this:80 #81 #Traceback (most recent call last):82 #File ".../django/template/__init__.py" in render_node83 # 750. result = node.render(context)84 #File ".../PyLucid/defaulttags/lucidTag.py" in render85 # 102. content = self._add_unique_div(context, content)86 #File ".../PyLucid/defaulttags/lucidTag.py" in _add_unique_div87 # 73. return u'<div class="%s" id="%s">\n%s\n</div>\n' % (88 #89 #UnicodeDecodeError at /FH-D-sseldorf/90 #'ascii' codec can't decode byte 0xc3 in position 55: ordinal not in range(128)91 #92 #content += "UnicodeDecodeError hack active!"93 return '<div class="%s %s" id="%s">\n%s\n</div>\n' % (94 settings.CSS_DIV_CLASS_NAME, str(self.plugin_name), str(id),95 content96 )97 98 99 64 def render(self, context): 100 65 local_response = SimpleStringIO() … … 120 85 raise AssertionError(msg) 121 86 122 content = self._add_unique_div(context, content) 87 content = add_css_tag( 88 context, content, self.plugin_name, self.method_name 89 ) 123 90 124 91 return content -
trunk/pylucid/PyLucid/index.py
r1228 r1283 36 36 from PyLucid.system.URLs import URLs 37 37 from PyLucid.system.context_processors import add_dynamic_context 38 from PyLucid.system.context_processors import add_css_tag 38 39 39 40 from PyLucid.tools.content_processors import apply_markup, \ … … 274 275 # print "---" 275 276 277 page_content = add_css_tag( 278 context, page_content, module_name, method_name 279 ) 280 276 281 return _render_cms_page(context, page_content) 277 282 -
trunk/pylucid/PyLucid/settings_example.py
r1221 r1283 382 382 ALLOW_SEND_MAILS = True 383 383 384 # Every Plugin output clasp around with a html DIV tag.385 # Here you can defined witch CSS class name the DIVtag should used:386 CSS_ DIV_CLASS_NAME = "PyLucidPlugins"384 # Every Plugin output gets a html SPAN tag around. 385 # Here you can defined witch CSS class name the tag should used: 386 CSS_PLUGIN_CLASS_NAME = "PyLucidPlugins" -
trunk/pylucid/PyLucid/system/context_processors.py
r1209 r1283 7 7 8 8 from PyLucid import PYLUCID_VERSION_STRING 9 from PyLucid.tools.shortcuts import makeUnique 10 9 11 from django.conf import settings 10 12 … … 55 57 56 58 59 60 def add_css_tag(context, content, plugin_name, method_name): 61 """ 62 Add a unique CSS-ID and a class name defined in the settings.py 63 """ 64 id = plugin_name + "_" + method_name 65 id = makeUnique(id, context["CSS_ID_list"]) 66 context["CSS_ID_list"].append(id) 67 class_name = getattr(settings, "CSS_PLUGIN_CLASS_NAME", "PyLucidPlugins") 68 69 try: 70 return u'<span class="%s %s" id="%s">\n%s\n</span>\n' % ( 71 class_name, plugin_name, id, content 72 ) 73 except UnicodeDecodeError: 74 # FIXME: In some case (with mysql_old) we have trouble here. 75 # I get this traceback on www.jensdiemer.de like this: 76 # 77 #Traceback (most recent call last): 78 #File ".../django/template/__init__.py" in render_node 79 # 750. result = node.render(context) 80 #File ".../PyLucid/defaulttags/lucidTag.py" in render 81 # 102. content = self._add_unique_div(context, content) 82 #File ".../PyLucid/defaulttags/lucidTag.py" in _add_unique_div 83 # 73. return u'<div class="%s" id="%s">\n%s\n</div>\n' % ( 84 # 85 #UnicodeDecodeError at /FH-D-sseldorf/ 86 #'ascii' codec can't decode byte 0xc3 in position 55: ordinal not in range(128) 87 # 88 #content += "UnicodeDecodeError hack active!" 89 return '<span class="%s %s" id="%s">\n%s\n</span>\n' % ( 90 class_name, str(plugin_name), str(id), 91 content 92 ) -
trunk/pylucid/PyLucid/tools/content_processors.py
r1276 r1283 108 108 109 109 110 110 111 def replace_add_data(context, content): 111 112 """
