Esempio n. 1
0
 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
Esempio n. 2
0
 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
Esempio n. 3
0
 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
Esempio n. 4
0
 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)