Newbie help - test for data type
Jonathan Bowlas
me at jonbowlas.com
Mon Jul 31 05:54:36 EDT 2006
Thanks Bruno, I'll use this.
Much appreciated.
Jon
-----Original Message-----
From: python-list-bounces+info=jonbowlas.com at python.org
[mailto:python-list-bounces+info=jonbowlas.com at python.org] On Behalf Of
Bruno Desthuilliers
Sent: 31 July 2006 10:37
To: python-list at python.org
Subject: Re: [OT]Newbie help - test for data type
Jonathan Bowlas wrote:
> Hi Listers,
>
> I have a requirement to test for a data type could someone tell me if this
> is possible in python?
>
> Basically I have a ZPT in Zope that users can select checkboxes in a form
> which pass arguments for a python function, however if there is only one
> checkbox selected it is passed as a string whereas more than one checkbox
is
> passed as a list.
You should have posted this on Zope's mailing-list.
<OT>
There's a mechanism in Zope to handle this case, cf section "Passing
Parameters to Scripts" in:
http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/DTML.stx/Scripti
ngZope.stx
The mechanism is based on 'decorating' forms fields names with type
annotation. In you case, this would look like:
<form name='xxx' action='yyy' method='POST'>
<tal:repeat repeat="code deptcodes">
<input type="checkbox" name='selecteddeptcodes:list' value=''
tal:attribute="value code" />
</tal:repeat>
<!-- rest of the form here -->
</form>
</OT>
HTH
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060731/c6cbf0ce/attachment.html>
More information about the Python-list
mailing list