| | 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 | ) |