[Zope] Re: Re: Help with unconsistent behavior of parameter passing toPython Scripts.

hans hans@beehive.de
Fri, 12 Apr 2002 16:53:59 +0100


febb wrote:

> Hi
> Thanks for replying.    Sure I did.  Actually I did called the
> script from a DTML Method / DMTL Document objects to be
> executed as the ACTION of an (html) FORM.
>

there are different points in time.
rendering the DTML happens on the server before the result is sent to the browser.
you may see what the browser has received w view/source or so.
then on the client (=browser) system a <form> is submitted
and the resulting request sent back to the server.
On the server, ZPublisher prepares a REQUEST object for you
and, since the url is your python script, ZPublisher calls it.
a DTML file's <form> does not call your script directly.

all the browser sends is strings.
You may tell ZPublisher to convert these strings
to something else by exploiting a little trick on the form variable names
(see again http://www.zope.org/Members/Zen/howto/FormVariableTypes,
also http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html)
Or, you may convert by using _.int(), _.float etc as converters,
which unfortunately applies to simple values only.
writing your own converter is a bit trickier.

> The same thing happenned. It was evaluated as a STRING instead
> of as a LIST as it actually is.
>
> I would have expected that the behavior of a plain python program (tested directly
> under python prompt), then the same program "ported" to be a Zope python script
> tested witht the internal Zope's "test" tab and later on called from DTML would behave
> the same.
>
> Any ideas?

hans