about PyLucid
download
documentation
contribute
blog
trac
forum
sitemap
FAQ
Search
Memberlist
Usergroups
Register
Profile
Log in to check your private messages
Log in
kwargs in template tag {% lucidTag ... %}
PyLucid - CMS - Forum Forum Index
->
system
View previous topic
::
View next topic
Author
Message
jens
Administrator
Joined: 12 Oct 2005
Posts: 972
Location: duisburg, germany
Posted: Mon 02 Jun, 2008 09:54
Post subject: kwargs in template tag {% lucidTag ... %}
The current implementation used regex for parsing the lucidTag kwargs:
Code:
KWARGS_REGEX = re.compile('''(\w*?)\=['"](.*?)['"]''')
see:
http://trac.pylucid.net/browser/trunk/pylucid/PyLucid/template_addons/lucidTag.py?rev=1612#L32
The biggest problem is: We can't pass other thing than normal strings
I add some unittest for this problem:
http://trac.pylucid.net/changeset/1615#file1
(at the bottom)
I add a ticked for this:
http://trac.pylucid.net/ticket/202
I thought we can use
data_eval.py
for parsing. But the format of a tag is not realy good for it. Example:
Code:
{% lucidTag unittest_plugin arg1="test1" arg2=3 arg3=True arg4="Foo Bar" %}
We can use data_eval if its looks like a dict:
Code:
{ "arg1":"test1" "arg2":3 "arg3":True "arg4":"Foo Bar" }
Converting the string from above to a dict one is not easy. I tried it here:
http://trac.pylucid.net/changeset/1615#file0
(The commented parts)
Solutions:
We can change the syntax of the lucidTag to a dict like syntax, e.g.:
Code:
{% lucidTag unittest_plugin "arg1":"test1" "arg2":3 "arg3":True "arg4":"Foo Bar" %}
Than we can easy extract the kwargs and evaluate it with data_eval.
On the other side, these syntax is a little more complex, isn't it?
Any feedback?
_________________
http://www.jensdiemer.de
|
http://www.htfx.de
|
http://www.python-forum.de
Back to top
Display posts from previous:
All Posts
1 Day
7 Days
2 Weeks
1 Month
3 Months
6 Months
1 Year
Oldest First
Newest First
PyLucid - CMS - Forum Forum Index
->
system
All times are GMT + 1 Hour
Page
1
of
1
Jump to:
Select a forum
PyLucid
----------------
general
system
plugins
external plugins
news
sonstiges
----------------
forum
offtopic
test
You
cannot
post new topics in this forum
You
cannot
reply to topics in this forum
You
cannot
edit your posts in this forum
You
cannot
delete your posts in this forum
You
cannot
vote in polls in this forum
<< back to PyLucid CMS Homepage
Powered by
phpBB
© 2001, 2005 phpBB Group