Show
Ignore:
Timestamp:
06/02/08 08:54:23 (2 years ago)
Author:
JensDiemer
Message:

problems with the current lucidTag kwargs pass, see:  http://pylucid.org/phpBB2/viewtopic.php?t=228

Files:
1 modified

Legend:

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

    r1612 r1615  
    2626from PyLucid.system.response import SimpleStringIO 
    2727from PyLucid.system.context_processors import add_css_tag 
     28from PyLucid.tools.data_eval import data_eval, DataEvalError 
    2829 
    2930from django.conf import settings 
     
    105106        {% lucidTag PluginName kwarg1="value1" kwarg2="value2" %} 
    106107    """ 
    107     content = token.contents 
    108     content = content.split(" ", 2)[1:] 
     108    raw_content = token.contents 
     109    content = raw_content.split(" ", 2)[1:] 
    109110    plugin_name = content.pop(0) 
     111 
     112    if "." in plugin_name: 
     113        plugin_name, method_name = plugin_name.split(".", 1) 
     114    else: 
     115        method_name = "lucidTag" 
     116 
     117#    print "1", content 
     118#    method_kwargs = {} 
     119#    if content: 
     120#        raw_kwargs = content[0] 
     121#        kwargs = raw_kwargs.replace("=", ":") 
     122#        kwargs = u"{ %s }" % kwargs 
     123#        print "2", kwargs 
     124#        try: 
     125#            method_kwargs = data_eval(kwargs) 
     126#        except DataEvalError, err: 
     127#            return lucidTagNodeError( 
     128#                plugin_name, method_name, 
     129#                msg = "Tag args error: %s" % err 
     130#            ) 
     131# 
     132#        print "3", method_kwargs 
    110133 
    111134    method_kwargs = {} 
     
    123146            method_kwargs[key] = value 
    124147 
    125     if "." in plugin_name: 
    126         plugin_name, method_name = plugin_name.split(".", 1) 
    127     else: 
    128         method_name = "lucidTag" 
    129  
    130148    return lucidTagNode(plugin_name, method_name, method_kwargs) 
    131149