faqts : Computers : Internet : Web Servers : Zope : Common Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

2 of 5 people (40%) answered Yes
Recently 1 of 4 people (25%) answered Yes

Entry

What's the best way to check if self.REQUEST.form.get('int_field') just contains numeric data in an external method?

Aug 9th, 2000 05:49
unknown unknown, Zope johanc


I think extending the input-tag name with :float, :int, or :long and 
test with type() from python would do the trick. 
I havn't tested it but theoretically it should work.
For more info on form field definitions check out Zen's
How-To: Form Variable Types and Typechecking.
(I have used :tuple to submit a sequences of strings in a get request, 
e.g. url? varname:tuple=first_string&varname:tuple=second_string...)