Skip to content
Browse files

SessionMixin fixed - wasn't working because of deprecated DB calls, a…

…lso wasn't creating new Sessions hen none existed. Minor documentation update.
  • Loading branch information...
1 parent e006d63 commit ad025ba388684514ae855aad73a2df3e65a4f739 @LBiNationalTrust LBiNationalTrust committed Oct 8, 2012
2 Documentation/docs/authentication.rst
@@ -75,7 +75,7 @@ The SessionMixin exposes some basic functionality that will let you get and set
it to the database.
All session data is stored in the SessionModel as a Base64 encoded string that is a ``dict``. To get and set session
-values is quite straightforward::
+values is quite straightforward as the session will be auto-created as soon as you start using the object::
from Mojo.Auth.Mixins.SessionMixins import SessionMixin_Sync
class loginHandler(MojoRequestHandler, SessionMixin_Sync):
4 Documentation/index.rst
@@ -3,8 +3,8 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
-Mojo v0.1 - a framework for Tornado
+Mojo v0.1.1 - a framework for Tornado
Mojo is a framework that makes it easy and quick to build Tornado projects that scale.
3 Mojo/Auth/Mixins/
@@ -114,7 +114,8 @@ def get_session_object(self):
if thisSessionObject is not None:
self.session.session_model = thisSessionObject
- thisSessionObject = Session()
+ from Mojo.Auth.SessionManager import Setup_session
+ self.session.session_model = Setup_session(Session())
return thisSessionObject
8 Mojo/Auth/
@@ -87,7 +87,7 @@ def _is_session_valid(self):
as the cookie expiry. Returns ``True`` or ``False``
if self.session_model is not None:
- if self.session_model.session_expires.get_value() >
+ if self.session_model.session_expires >
return True
return False
@@ -100,7 +100,7 @@ def _set_session_key(self, key, value):
function will go through a `check -> decode -> set` process and set the ``session_model`` attribute of the ``SesionManager``
if self.session_model.session_data is not None:
- session_data = self._decode_session(self.session_model.session_data.get_value())
+ session_data = self._decode_session(self.session_model.session_data)
session_data[key] = value
session_data = {key:value}
@@ -117,7 +117,7 @@ def _get_session_key(self, key):
if self._is_session_valid():
session_data = {}
if self.session_model is not None:
- session_data = self._decode_session(self.session_model.session_data.get_value())
+ session_data = self._decode_session(self.session_model.session_data)
if key in session_data:
return session_data[key]
@@ -154,7 +154,7 @@ def _create_new_session(self):
new_session = Setup_session(Session())
self.session_model = new_session
- self.request_handler.set_secure_cookie('session_id', new_session.session_key.get_value())
+ self.request_handler.set_secure_cookie('session_id', new_session.session_key)
return self.session_model
def Setup_session(sessionObj, expiry_days=30, expiry_hours=0, expiry_minutes=0):

0 comments on commit ad025ba

Please sign in to comment.
Something went wrong with that request. Please try again.