"evaluating" a REQUEST Parameter to be passed to a dtml-var
Hello, Sorry, but I'm new at this :) The problem is simple, I want to call a dtml-var using a name (object) provided by the URL So for instance if the url is: http://host/cmf?document=main_english I want <dtml-var main_english fmt="structured-text"> to work properly. Of course the problem I'm having right now is that the parameter value is being passed as a string instead of being eval'ed ... So instead of the contents of "main_english" I get the STRING "main_english"! Unfortunately (Although for good reason) python's "eval" is not available ... So how do I do it? Thanks! Jean-François Doyon Internet Service Development and Systems Support GeoAccess Division Canadian Center for Remote Sensing Natural Resources Canada http://atlas.gc.ca Phone: (613) 992-4902 Fax: (613) 947-2410
Hi Jean-Francois! There is more than one approach. If you have the id of your object as a string in the REQUEST variable "document", try <dtml-let document_object="_[document]"> <dtml-var document_object fmt=structured-text> </dtml-let> or, this is more precise: <dtml-let document_object="_[REQUEST['document']]"> <dtml-var document_object fmt=structured-text> </dtml-let> for a start. Sorry for the briefness of this reply hth, Danny On Wednesday 17 October 2001 09:34, Doyon, Jean-Francois wrote:
Hello,
Sorry, but I'm new at this :)
The problem is simple, I want to call a dtml-var using a name (object) provided by the URL
So for instance if the url is:
http://host/cmf?document=main_english
I want <dtml-var main_english fmt="structured-text"> to work properly.
Of course the problem I'm having right now is that the parameter value is being passed as a string instead of being eval'ed ... So instead of the contents of "main_english" I get the STRING "main_english"!
Unfortunately (Although for good reason) python's "eval" is not available ...
So how do I do it?
Thanks!
Jean-François Doyon Internet Service Development and Systems Support GeoAccess Division Canadian Center for Remote Sensing Natural Resources Canada http://atlas.gc.ca Phone: (613) 992-4902 Fax: (613) 947-2410
_______________________________________________ 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 )
use getattr(container,main_english) in yout python script <dtml-var expr="_.getitem(main_english)"> in dtml On Tue, 16 Oct 2001, Doyon, Jean-Francois wrote:
Hello,
Sorry, but I'm new at this :)
The problem is simple, I want to call a dtml-var using a name (object) provided by the URL
So for instance if the url is:
http://host/cmf?document=main_english
I want <dtml-var main_english fmt="structured-text"> to work properly.
Of course the problem I'm having right now is that the parameter value is being passed as a string instead of being eval'ed ... So instead of the contents of "main_english" I get the STRING "main_english"!
Unfortunately (Although for good reason) python's "eval" is not available ...
So how do I do it?
Thanks!
Jean-François Doyon Internet Service Development and Systems Support GeoAccess Division Canadian Center for Remote Sensing Natural Resources Canada http://atlas.gc.ca Phone: (613) 992-4902 Fax: (613) 947-2410
_______________________________________________ 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 )
-- __o _ \<_ (_)/(_) Saludos de Julián EA4ACL -.-
Hi, In my current project I have quite a few ZClasses that can only be created from forms in an instance of another class. For example, I have a class ContactList normally only containing Contacts. I create new Contacts using a method of ContactList. Can I safely delete the Contact_add, Contact_addForm, Contact_factory and Contact_add_permission items from the ZClass folder? Douwe
participants (4)
-
Danny William Adair -
Douwe Osinga -
Doyon, Jean-Francois -
Julián Muñoz Domínguez