Commits

Anonymous committed 6675142

Added has_session method to paste.session

  • Participants
  • Parent commits 88299a7

Comments (0)

Files changed (1)

File paste/session.py

         self.session = session
         return session.data()
 
+    def has_session(self):
+        if self.session is not None:
+            return True
+        cookies = request.get_cookies(self.environ)
+        if cookies.has_key(self.cookie_name):
+            return True
+        return False
+
     def make_sid(self):
         # @@: need better algorithm
         return (''.join(['%02d' % x for x in time.localtime(time.time())[:6]])