Exemple #1
0
 def session(self):
     if not self._session:
         sid = self.get_secure_cookie(settings.SID_COOKIE)
         if sid:
             session = Session(sid)
             session.load()
         else:
             session = Session()
         self.set_secure_cookie(settings.SID_COOKIE, session.sid)
         self._session = session
     return self._session
Exemple #2
0
 def get_user_id(self, sid_cookie):
     sid = decode_signed_value(settings.TORNADO_APP['cookie_secret'],
                               settings.SID_COOKIE, sid_cookie)
     session = Session(sid)
     session.load()
     return session['user']
Exemple #3
0
 def get_user_id(self, sid_cookie):
     sid = decode_signed_value(settings.TORNADO_APP['cookie_secret'],
                               settings.SID_COOKIE, sid_cookie)
     session = Session(sid)
     session.load()
     return session['user']