def findBySessionId(self) : view=dblayer.view("user/sessionId",self.sessionId) if len(view) == 0 : return None elif len(view) == 1: for u in view : return User.load(getDb(),u.id) else : print 'WARNING: critical error, more than one user with sthe same session Id ' raise IntegrityConstraintException
def findByActivationCode(self) : view=dblayer.view('user/activationCode',self.activationCode) if len(view) == 0 : return None elif len(view) == 1: for u in view : return User.load(getDb(),u.id) else : print 'WARNING: critical error, more than one user with same activation Code ' raise IntegrityConstraintException
def findByLogin(self) : ''' return the actual version of the user. ''' view=dblayer.view("user/login",self.login) if len(view) == 0 : return None elif len(view) == 1: #TODO optimize for u in view : return User.load(getDb(),u.id) else : print 'WARNING: critical error, more than one user for same login' raise IntegrityConstraintException
def findById(self) : view=dblayer.view("keyword/id",self._id) if len(view) == 0 : return None elif len(view) == 1: for u in view : return Article.load(getDb(),u.id)