Example #1
0
 def setUp(self):
     """Setup test fixture for each model test method."""
     try:
         new_attrs = {}
         new_attrs.update(self.attrs)
         new_attrs.update(self.do_get_dependencies())
         self.obj = self.klass(**new_attrs)
         DBSession.add(self.obj)
         DBSession.flush()
         return self.obj
     except:
         DBSession.rollback()
         raise
Example #2
0
 def test_query_obj(self):
     """Model objects can be queried"""
     obj = DBSession.query(self.klass).one()
     for key, value in self.attrs.items():
         eq_(getattr(obj, key), value)
Example #3
0
 def tearDown(self):
     """Tear down test fixture for each model test method."""
     DBSession.rollback()
Example #4
0
 def by_user_name(cls, username):
     """Return the user object whose user name is ``username``."""
     return DBSession.query(cls).filter_by(user_name=username).first()
Example #5
0
 def getbyId(cls, id):
     return DBSession.query(cls).get(id)
Example #6
0
 def by_email_address(cls, email):
     """Return the user object whose email address is ``email``."""
     return DBSession.query(cls).filter_by(email_address=email).first()
Example #7
0
 def getProblemByProject(cls,id):
     return  DBSession.query(cls).filter(cls.id_track_module == str(id)).all();
Example #8
0
 def getByPageId(cls, pageid):
     return DBSession.query(cls).filter(
         cls.id_owner_page == pageid).order_by(cls.seq).all()
Example #9
0
 def checkSecureKey(cls,id,securekey):
     module = DBSession.query(cls).filter(cls.id_track_module == str(id), cls.secure_key == str(securekey) ).first();
     if module and module.active == 1 :
         return module;
     return None;
Example #10
0
 def getByIdAndSecureKey(cls,id,securekey):
     return DBSession.query(cls).filter(cls.id_track_module == str(id), cls.secure_key == str(securekey) ).first();
Example #11
0
 def getAll(cls):
     return DBSession.query(cls).all();
Example #12
0
 def save(self):
     DBSession.add(self); 
     DBSession.flush() ;
Example #13
0
 def getListByProjectAndProblemType(cls,projectId,problemId,offset,limit):
     if int( offset) == 1:
         offset = 0;
     else:
         offset  = (int(offset) -1 ) * int( limit);
     return  DBSession.query(cls).filter(cls.id_track_module == str(projectId),cls.id_problem_type == str(problemId)).offset( int( offset )   ).limit(limit).all();