[Zope] Processing form data.

Pavlos Christoforou pavlos@gaaros.msrc.sunysb.edu
Fri, 27 Aug 1999 12:53:44 -0400 (EDT)


On Fri, 27 Aug 1999, Fredrick Rybarczyk - LUB NetLab wrote:

> Hi there!
> 
> I'm rewriting a dissertation abstract database + web interface from
> scratch and I'd like to use Zope with postgres for my little app. I've
> tried to follow the list during the last three weeks and I've briefed
> through most of the documentation. Even so, I'd like to ask a couple of
> newbie questions to get up in speed.
> 
> 1: I'd like to process forms with external methods since I've got rather
> complicated input. How do I access the querystring from an external
> method?

you could either access the query variables from the REQUEST object or
directly as arguments in the external method definition. In other words if
your form defines a variable 'age', then:

def double_age(self,age):
	return int(age)*2

will work fine because ZPublisher will pass the neccessary form variables
to match the ones defined in the argument list of your external method.

> 2: Since 'Zope Zen' yet has to show up around my office, would anyone
> like to suggest an alternative method to using external methods?

If your proceessing rules are complicated better stick with external
methods. Otherwise dtml may suffice.

> 3: I will also need to url encode my data. Can Zope handle that / is
> there a module for it somewhere?

I believe url_encode is an option available through DTML scripting.
Otherwise I am pretty sure there are more than one modules containing such
utilities. One should be in ZPublisher somehwere, but I don't remember of
hand.

Pavlos