i am trying to pass the parameter to another method and i am getting an exception.
import web
import json
class Process:
def request(self, query_string):
print query_string
def GET(self):
params = web.input()
request(params)
return json.dumps(dict(foo=55))
This gives me.
<type 'exceptions.NameError'> at /process
global name 'request' is not defined
Can any one explain why i cannot pass the variable to another method.
replace
request(params)withself.request(params)All relations have to be explicitly stated in python. It’s not like C++ or Java where class functions are automatically visible to one another. You have to explicitly reference self to access them.