[Zope] Form-Submit

Casey Duncan cduncan@kaivo.com
Fri, 16 Mar 2001 08:31:39 -0700


Axel Missbach wrote:
> 
> I want to call a form within a method. The address is submitted with the
> REQUEST.
> Using
> <dtml-var address>
> only shows the content of address.
> or
> <dtml-call address>
> shows only an emtpy screen
> 
> I have tried it with or without quotation mark.
> 
> Manuelly calling
> 
> <dtml-var "main.sub.detail.formular">(which is the content of address)
> works fine.
> 
> Changing the address in "main/sub/detail/formular", doesn't change the
> behavior.
> 
> Please tell me how to handle this.
> 
> Axel
> 

What I gather you are saying is that address contains a string like
"main.sub.detail.formular" which is supposed to point to a method in
your Zope instance. Zope cannot resolve Python expressions stored in
string using TTW scripting (DTML or Python scripts), because of security
implications.

There is however a mechanism to resolve objects based on their url path.
It is a method of the REQUEST object called resolve_url. If you pass it
a string like "/main/sub/detail/formular", it will resolve it to the
actual zope object and return it. Here is how you could call and render
it in place:

<dtml-var expr="REQUEST.resolve_url(address)">

As an aside thought, there is almost always a better way to accomplish
this using acquisition. I have never in actual practice found myself
using this technique, simply because it is done implicitly for you by
Zope on ever REQUEST. Although I am not familiar with your exact
application, I can pretty much guarantee that there is a more elegant
way to implement your desired behavior.
-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>