Called function conditional testing (if) of form variables problem

Eduardo Biano edbiano at rocketmail.com
Wed Jun 15 23:05:02 EDT 2005


Hi,

I have a problem making conditional testing (if) of a
form variable "ans01"(refer generated error). When the
form variable is tested (if) by a called function
(foo) the value of "ans01" is not properly
represented.  


def foo(request):
    ans01 = request.get_form_var("ans01") 
    if ans01 == 4:
        ans_1 = 1
        return ans_1  

The browser returns a blank screen or ans_1 is blank.
I tried to "return ans01" and the browser returned the
number 4. I am quiet sure of the above code and
searched python resources but found no solution.
Please help. Thank you in advance. 
   
**************************
Below is a generated error to check the contents of
submitted form.
___________________________
..................
NameError: ................... 

Form:
ans01           4
ans02           1
ans03           1
ans04           1
ans05           1
ans06           1
ans07           1
comments        
headid          068A114
id              0646205
submit           Submit 
*******************************





		
__________________________________ 
Discover Yahoo! 
Get on-the-go sports scores, stock quotes, news and more. Check it out! 
http://discover.yahoo.com/mobile.html



More information about the Python-list mailing list