I need to set the session for a SWF file uploader. I am doing a work
around to POST the session.id value and then use session.get_by_id to
replace the current session. However it's still returning None. But
when I use session.get_by_id from the pylons shell it works.
# newsession value is set to None
if request.POST.has_key('__session_id'):
session_id = request.POST['__session_id']
log.debug("session_id: '%s'" % session_id)
# Get the new session by sessionID
newsession = session.get_by_id(session_id)
log.debug("newsession: %s" % newsession)
if not newsession:
abort(401, 'Authorization Required')
# Load the registry and replace our global session with
the new one
registry = request.environ['paste.registry']
registry.register(session, newsession)
# Replace the other session reference to look to the new
one
pylons_obj = pylons.request.environ['pylons.pylons']
pylons_obj.session = newsession
Code Used in Pylons shell to get the session:
from pylons import request, response, session
session_id = '3ed0464d8ed08afe623fe521d0c65359'
print session.get_by_id(session_id)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---