[Zope] Form Variable

Jonathan Hobbs toolkit at magma.ca
Wed Sep 22 16:25:48 EDT 2004


----- Original Message -----
From: "Paul Winkler" <pw_lists at slinkp.com>
> >
> > ----- Original Message -----
> > From: "Asad Habib" <ahabib at engin.umich.edu>
> > > I have a form variable whose value is being passed to a DTML method
upon
> > > form submission. In this DTML method, I use the form variable as input
to
> > > a <dtml-in>. When this form variable is passed as a list(i.e. it
contains
> > > multiple values), everything works fine. However, when this form
variable
> > > is passed as a string(i.e. it contains a single value), <dtml-in>
> > > complains that it is being passed an input of the wrong type. Is there
a
> > > way to detect whether this form variable is a list or string? Using
the
> > > len function doesn't work because len works on both strings and lists.
> >
> > You need the python 'type' statement, which unfortunately isn't
available to
> > python scripts (its use is restricted). Therefore, you need a small
external
> > method:
>
> What's wrong with same_type which zope provides for this purpose?

I've been using my 'typeof' external method for about 100 years - it feels
that long :),

but I like the new (new-to-me!) same_type function!






More information about the Zope mailing list