Show
Ignore:
Timestamp:
10/23/07 13:12:39 (13 months ago)
Author:
JensDiemer
Message:

-"add_css_tag" for _command, too.
-rename settings.CSS_DIV_CLASS_NAME -> settings.CSS_PLUGIN_CLASS_NAME

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pylucid/PyLucid/defaulttags/lucidTag.py

    r1264 r1283  
    2525from PyLucid.system.plugin_manager import run 
    2626from PyLucid.system.response import SimpleStringIO 
    27 from PyLucid.tools.shortcuts import makeUnique 
     27from PyLucid.system.context_processors import add_css_tag 
    2828 
    2929from django.conf import settings 
     
    6262        ) 
    6363 
    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 in 
    67         the settings.py 
    68         """ 
    69         id = self.plugin_name + "_" + self.method_name 
    70         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, content 
    76             ) 
    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_node 
    83             #    750. result = node.render(context) 
    84             #File ".../PyLucid/defaulttags/lucidTag.py" in render 
    85             #    102. content = self._add_unique_div(context, content) 
    86             #File ".../PyLucid/defaulttags/lucidTag.py" in _add_unique_div 
    87             #    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                 content 
    96             ) 
    97  
    98  
    9964    def render(self, context): 
    10065        local_response = SimpleStringIO() 
     
    12085            raise AssertionError(msg) 
    12186 
    122         content = self._add_unique_div(context, content) 
     87        content = add_css_tag( 
     88            context, content, self.plugin_name, self.method_name 
     89        ) 
    12390 
    12491        return content