For some reason i am unable to instantiate the set_cookie outside of the MainHandler.. This is a little code to show what im wanting to do.. Can Anyone help??
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from tornado.options import define, options
from GenCookie import *
class MainHandler(tornado.web.RequestHandler):
def get(self):
g=GenCookie()
response = g.genCookie()
class GenCookie:
def genCookie(self):
print self.request.remote_ip
print self.cookies
print self.request.headers
expires = datetime.datetime.utcnow() + datetime.timedelta(days=365)
if ("uid" in cookies):
self.set_cookie("uid", value=cookies["uid"],expires=expires)
else:
self.set_cookie("uid", value='dfc278623ab44df2bd501e106e81d146',expires=expires)
return
Any ideas?