def fill_session(self, request): """ Fills session data. """ session = request.getSession() user = IUser(session) profile = user.get_profile() if not profile.validated: self.senderrback( request, {'message' : 'Lo sentimos pero parece ser que su usuario aún no ha sido validado.<br />'+\ 'Ponte en contacto con la secretaría de Organización de tu sindicato.', 'number' : http.SESSION_NOT_VALID }) session.expire() return if not user.is_active(): self.senderrback( request, {'message' : 'Lo sentimos pero parece ser que su usuario aún no ha sido activado.<br />'+\ 'Ponte en contacto con la secretaría de Organización de tu sindicato.', 'number' : http.SESSION_NOT_ACTIVE }) session.expire() return sess_data = user.__rpr__() sess_data['userProfile'] = {'nia': profile.nia} return sess_data
def _expired(self, session): print "Session {0} has expired.".format(session.uid) from goliat.session.usermanager import UserManager from goliat.session.user import IUser user = IUser(session) UserManager().unregister(user) self.sessions.remove(session.uid)
def get(self, uid, session=None): """ Get an user from the users registry, or create a new one if session is a valid session, otherwise return None. """ if uid in self.users: return self.users[uid] if session!=None and session.is_authed(): user=IUser(session) try: user.load(uid) self.register(user) return user except: pass return None
def get(self, uid, session=None): """ Get an user from the users registry, or create a new one if session is a valid session, otherwise return None. """ if uid in self.users: return self.users[uid] if session != None and session.is_authed(): user = IUser(session) try: user.load(uid) self.register(user) return user except: pass return None