On Wed, Sep 22, 2004 at 03:21:21PM -0400, Jonathan Hobbs wrote:
----- Original Message ----- From: "Asad Habib" <ahabib@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? -- Paul Winkler http://www.slinkp.com