def getSession(self): """Get the session data container that stores the OpenID request.""" if IUnauthenticatedPrincipal.providedBy(self.request.principal): # A dance to assert that we want to break the rules about no # unauthenticated sessions. Only after this next line is it # safe to set session values. allowUnauthenticatedSession(self.request, duration=timedelta(minutes=60)) return ISession(self.request)[SESSION_PKG_KEY]
def getSession(self): """Get the session data container that stores the OpenID request.""" if IUnauthenticatedPrincipal.providedBy(self.request.principal): # A dance to assert that we want to break the rules about no # unauthenticated sessions. Only after this next line is it # safe to set session values. allowUnauthenticatedSession( self.request, duration=timedelta(minutes=60)) return ISession(self.request)[SESSION_PKG_KEY]
def redirect(self, location, status=None, trusted=True): """See lp.services.webapp.interfaces.INotificationResponse""" # We are redirecting, so we need to stuff our notifications into # the session if self._notifications is not None and len(self._notifications) > 0: # A dance to assert that we want to break the rules about no # unauthenticated sessions. Only after this next line is it safe # to set the session. allowUnauthenticatedSession(self._request) session = ISession(self)[SESSION_KEY] session['notifications'] = self._notifications return super(NotificationResponse, self).redirect( location, status, trusted=trusted)