Hi,
For cross domain security purpose, I need a OPTIONS request method in my
app.
It looks like:
class upload:
def POST(self):
i*f logged():*
i = web.input(myfile={})
web.header('Content-Type', 'text/javascript')
web.header('Access-Control-Allow-Origin', 'http://example.com')
web.header('Access-Control-Allow-Credentials', 'true')
# do something with myfile here
def OPTIONS(self):
web.header('Content-Type', 'text/javascript')
web.header('Access-Control-Allow-Origin', 'http://example.com')
web.header('Access-Control-Allow-Credentials', 'true')
And the logged() function looks like:
def logged():
if session.logged_in==True:
return True
else:
return False
For sessions, the code is:
store = web.session.DiskStore('sessions')
if web.config.get('_session') is None:
session = web.session.Session(app, store, initializer={'logged_in':
False,'user_id':0})
web.config._session = session
else:
session = web.config._session
And in my login and logout classes, I set session.logged_in accordingly.
The problem is GET and POST methods are all worked fine (all the classes
with GET or POST method), could get the right session.logged_in value, but
if OPTIONS method involved, then the session.logged_in value always be the
default value which is False.
So is that because OPTIONS method does not supported in webpy? or there is
other trick here?
Thanks,
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/d/optout.