[Zope-dev] exec in zope?

R. David Murray bitz@bitdance.com
Tue, 23 May 2000 12:16:00 -0400 (EDT)


On Tue, 23 May 2000, Andrew Edmondson wrote:
> The following doesn't work, but it illustrates my idea:
> 	<dtml-in "Catalog(_.getitem(search_in)   =   _.getitem(search_for))">
> 
> The obvious way to do this in python would be to use the 'exec' command - but
> that doesn't seem to work in zope.
> 
> Is there any way to do this in zope?

You will probably have to write an external method to do it the way
you show.  Exec is disallowed in DTML for security reasons, and
I at least can't think of any other way to pass a named parameter
in to a procedure call if you don't know the name of the paramter until
run time.

On the other hand, if you call the catalog via just

<dtml-in Catalog>

it will pull its search fields out of the REQUEST variable.  If you
can arrange it so that REQUEST contains just the appropriate search
variables set to the appropriate search values, you should be home free.

--RDM