[Zope] dtml-var AND dtml-tree
Danny William Adair
Danny@Adair.net
Thu, 12 Apr 2001 19:33:37 +1200
For the people who have problems with dtml-tree's "urlparam" only handling
constants...
I patched "lib/python/TreeDisplay/TreeTag.py" so that I can have a parameter
"urlparam_var", an object on the namespace that holds the querystring I want
to insert. This is the first time I patched zope internals, but it works
fine. Maybe someone who knows better can comment on this.
in __init__ I inserted another parameter urlparam_var:
args=parse_params(
...
urlparam=None, urlparam_var=None)
in tpRenderTABLE
I added rendering of "urlparam_var" and made sure there's no "urlparam"
being passed at the same time:
...
# Propagate extra args through tree. (I only changed the block
that starts with this comment)
if args.has_key('urlparam_var'):
if args.has_key('urlparam'):
raise ParseError, _tm(
'urlparam and urlparam_var given', 'tree')
tmp=args['urlparam_var']
param = md.getitem(tmp, 0)
param = "%s&" % param
elif args.has_key('urlparam'):
param = args['urlparam']
param = "%s&" % param
else:
param = ""
...
That's it.
Now, I just have to set the query string by inserting a DTML variable that
holds it, for example a REQUEST variable:
<dtml-call "REQUEST.set('querystring', myString)">
<dtml-tree ... urlparam_var="querystring">
...
</dtml-tree>
Thanks for your comments,
hope it helps someone that needs a quick (and cookieless) solution
Danny
>>> -----Ursprungliche Nachricht-----
>>> Von: zope-admin@zope.org [mailto:zope-admin@zope.org]Im Auftrag von
>>> Dieter Maurer
>>> Gesendet: Freitag, 16. Marz 2001 09:00
>>> An: nuno
>>> Cc: zope@zope.org
>>> Betreff: Re: [Zope] dtml-var AND dtml-tree
>>>
>>>
>>> nuno writes:
>>> > I'm trying to submit a form to a dtml-document (as action)
>>> > which i did. But if a have a dtml-tree in the action Document
>>> > the recursion doesn't work on clicking on the +/- icon when
>>> i try to access
>>> > a dtml-var
>>> > passed through the form.
>>> I answered similar questions at least three times recently
>>> (you know the searchable mailing list archives (or Google)?).
>>>
>>> Put a feature request into the collector:
>>>
>>> you want an "urlparam_expr" attribute for "dtml-tree"....
>>>
>>>
>>>
>>> Dieter
>>>
>>> _______________________________________________
>>> Zope maillist - Zope@zope.org
>>> http://lists.zope.org/mailman/listinfo/zope
>>> ** No cross posts or HTML encoding! **
>>> (Related lists -
>>> http://lists.zope.org/mailman/listinfo/zope-announce
>>> http://lists.zope.org/mailman/listinfo/zope-dev )
>>>