I'm using gae-sessions. How can I retrieve a session using only its session identifier (SID)?
Update for response @David Underhill: I've done what you told but in debug mode I got this: Session: SID=None {} | but it has db_key populated with a string
Here is my code:
upload.py
SID = self.request.get("SID")
if not SID:
return False
from app.models.user import User
user = User.get_current_user(SID)
user.py
def get_current_user(SID = None):
if SID:
session = Session(sid=SID)
else:
session = get_current_session()
if session.has_key('account.logged'):
return User.get(db.Key(session.get('user.key')))
else:
return False
and doesn't exists.
And this is my SID from my cookie: "mMumLZOCq5knTg9edaSjLD+p8xsSohAQSS9vyqpgDso=1289155992_9c2c85c6931a7d133f7e1f0b9ae25502gAJ9cQB9cQEoVQ5hY2NvdW50LmxvZ2dlZHECiFUIdXNlci5rZXlxA1UjYWd0MGIzUjBlWE4zYjNKc1pISUxDeElFVlhObGNoaTNBUXdxBFULYWNjb3VudC5rZXlxBVUnYWd0MGIzUjBlWE4zYjNKc1pISU9DeElIUVdOamIzVnVkQmkyQVF3cQZVDWFjY291bnQuZW1haWxxB1UBdHEIdYZxCS4="
I take this from cookies, with javascript and flex and then send it in a var to python.