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
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 )
Danny William Adair wrote -
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.
It's always a temptation to patch and add features since it's so easy to do with Zope. But it's a bit dangerous because the changes could get lost or forgotten when you upgrade to a new version. Also, other people can't use your code unless they install the changes too. Cheers, Tom P
"Thomas B. Passin" wrote:
Danny William Adair wrote -
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.
It's always a temptation to patch and add features since it's so easy to do with Zope. But it's a bit dangerous because the changes could get lost or forgotten when you upgrade to a new version. Also, other people can't use your code unless they install the changes too.
Patches like this probably should be done in a manner like hot-fix products. DC's hot-fixes reside in the Products directory and generally override a Zope internal function or two. Take a look at one. They are not very complicated. The nice thing with a hot-fix-like product is that if you decide it does bad voodoo (and presumably does not corrupt your ZODB), you still have your functioning zope installation if you remove the product from the Products folder and restart. No worries about finding the files you patched and getting everything back the way it was. A minor bad thing would be if a function you are overriding gets updated in a substantial way in a new release, but it should be a simple matter to check to see that your overriding functions still do substantially what the upgraded originals do. Come to think of it, it would be about the same effort as would be required for re-patching the source for every new release. -- Jim Washington
Jim Washington wrote -
It's always a temptation to patch and add features since it's so easy to do with Zope. But it's a bit dangerous because the changes could get lost or forgotten when you upgrade to a new version. Also, other people can't use your code unless they install the changes too.
Patches like this probably should be done in a manner like hot-fix products. DC's hot-fixes reside in the Products directory and generally override a Zope internal function or two. Take a look at one. They are not very complicated.
Yes, I looked and see how they set things up in an __init__.py script, very slick. A nice thing about Python is that you can actually replace functions and class methods without changing the original source code, if you can get the new definitions installed after the original ones are imported. I used to change how urllib handled file: URLs that way (not in Zope). When do the Hotfixes get run, do you know? Cheers, Tom P
participants (4)
-
Danny William Adair -
Dieter Maurer -
Jim Washington -
Thomas B. Passin