예제 #1
0
 def getByContentType(cls,idContentType,lang='en',active=1):
     
     return DBSession.query(cls).join(cls.language).\
         filter( func.upper(  FixLanguage.code) ==  func.upper(lang )  ).\
         filter(cls.active == str(active).decode('utf-8'), cls.id_content_type == str(idContentType ).decode('utf-8'))\
         .union( DBSession.query(cls).join(cls.language).\
         filter( func.upper(  FixLanguage.code) ==  func.upper('en' )  ).\
         filter(cls.active == str(active).decode('utf-8'), cls.id_content_type == str(idContentType ).decode('utf-8'))).first()
예제 #2
0
 def getScoreViewHtml(cls):
     
    # print "contextual_connect : %s" %( 'contextual_connect' in DBSession)
     
     
     
     env =  DBSession.query(cls).filter(cls.environment_key  == str('SCORE_VIEW_HTML').decode('utf-8') ,  cls.active == str('1').decode('utf-8')).first();
     return env.description;
예제 #3
0
파일: mail.py 프로젝트: tongpa/pypollmodel
 def updateStatusSended(cls,id):
     
     try:
         #sql = "update sur_send_mail set status= 'F', sended_date='" + str(datetime.now()) + "' where id_send_mail = " + str(id);
         #result = DBSession.execute(sql);
         #DBSession.flush() ;            
         #DBSession.execute("UNLOCK TABLES");
         #email = DBSession.query(cls).filter(cls.id_send_mail == id).first();
         #email.status = 'F';
         
         DBSession.query(cls).filter(cls.id_send_mail == id).update({"status": 'F',"sended_date" : datetime.now() }) ;
         DBSession.flush() ;
         
         return True, 'success';
     except Exception as  e:
         print "Exception----------> : "
         print e;  
         return False, 'Cannot delete.';#e.__str__();
예제 #4
0
파일: mail.py 프로젝트: tongpa/pypollmodel
 def updateStatusReaded(cls,code):
     sendmail = DBSession.query(cls).filter(cls.gen_code == code).first() ;
     if sendmail :
         sendmail.total_read = sendmail.total_read +1
         if sendmail.readed_date :
             sendmail.update_readed_date =  datetime.now()
         else:
             sendmail.readed_date =  datetime.now()
         return True, 'success'
     
     return False, 'Not Found'
예제 #5
0
파일: mail.py 프로젝트: tongpa/pypollmodel
 def querySendMail(cls,page=0,page_size=None):
     query = DBSession.query(cls).filter(cls.status == str('W')  );
     if page_size:
         query = query.limit(page_size)
     if page: 
         query = query.offset(page*page_size)
     
     value = query.all();
     
      
     
     return value;
예제 #6
0
 def getBySearch(cls, search="", page=0, page_size=None, act=1):
     query = DBSession.query(cls).filter(
         cls.message.like('%' + str(search) + '%'), cls.active == str(act))
     query_total = query
     if page_size:
         query = query.limit(page_size)
     if page:
         page = 0 if page < 0 else page
         query = query.offset(page * page_size)
     values = query.all()
     total = query_total.count()
     #data = [];
     #for v in values:
     #    data.append(v.to_json());
     return values, total
예제 #7
0
 def getByUserId(cls,user_id):      
     return DBSession.query(User).filter(User.user_id == str(user_id).decode('utf-8') ).first();
예제 #8
0
파일: auth.py 프로젝트: tongpa/pypollmodel
 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()
예제 #9
0
 def getEmailTemplate(cls):
     env =  DBSession.query(cls).filter(cls.environment_key  == str('EMAIL_TEMPLATE').decode('utf-8') ,  cls.active == str('1').decode('utf-8')).first();
     return env.description;
예제 #10
0
 def getServerUrl(cls):
     env =  DBSession.query(cls).filter(cls.environment_key  == str('SERVER_URL').decode('utf-8') ,  cls.active == str('1').decode('utf-8')).first();
     return env.description;
예제 #11
0
파일: auth.py 프로젝트: tongpa/pypollmodel
 def getId(cls, act):
     return DBSession.query(cls).get(act)
예제 #12
0
 def getSocialByUserId(cls,user_id):
     return DBSession.query(SocialType,cls).outerjoin(cls, and_(SocialType.id_social_type == cls.id_social_type,  cls.user_id == str(user_id).decode('utf-8') ) ).all();
예제 #13
0
 def getByUserIdAndSocialId(cls,user_id,socialId):
     return DBSession.query(cls).filter(cls.user_id == str(user_id).decode('utf-8'), cls.id_social_type == str(socialId).decode('utf-8') ).first();
예제 #14
0
 def getByPageandZone(cls,pageName,ZoneNumber,active=1):
     return DBSession.query(cls).filter( cls.page_name.ilike("%"+pageName+"%") , cls.zone_number == str(ZoneNumber), cls.active == str(active).decode('utf-8')).first(); 
예제 #15
0
 def getUserLinkBy(cls, idUser, idTest, idPublic):
     return (
         DBSession.query(cls)
         .filter(cls.id_user == str(idUser), cls.id_test == str(idTest), cls.id_question_option == str(idPublic))
         .first()
     )
예제 #16
0
 def getUserLinkVoterBy(cls, idLink, idUserRef):
     return (
         DBSession.query(cls)
         .filter(cls.id_use_external_link == str(idLink), cls.id_user_ref == str(idUserRef))
         .first()
     )
예제 #17
0
 def getById(cls, id_detail_report=0, act=1):
     return DBSession.query(cls).filter(
         cls.id_detail_report == str(id_detail_report),
         cls.active == str(act)).first()
예제 #18
0
 def getAll(cls, act=1):
     return DBSession.query(cls).filter(
         cls.active == str(act).decode('utf-8')).all()
예제 #19
0
 def getUserActivated(cls,user_id):
     return DBSession.query(cls).filter(cls.id_gen_code_type == str('2').decode('utf-8'),cls.success == str("1").decode('utf-8'),cls.user_id == str(user_id).decode('utf-8')).order_by(desc( cls.create_date )).first();    
예제 #20
0
 def deleteById(cls,id):
     result = DBSession.query(cls).filter(cls.id_user_social_network == id).delete()
     DBSession.flush()
     return result
예제 #21
0
 def getByDeactivateCode(cls,code):
     return DBSession.query(cls).filter(cls.id_gen_code_type == str('6').decode('utf-8'),cls.success == str("1").decode('utf-8') ,cls.code == str(code).decode('utf-8')).order_by(desc( cls.create_date )).first();
예제 #22
0
 def getByid(cls,id,act):
     return DBSession.query(cls).filter( cls.id_social_type == str(id).decode('utf-8')   , cls.active == str(act).decode('utf-8') ).first();
예제 #23
0
 def getByUserId(cls,user_id):
     return DBSession.query(cls).filter(cls.user_id == str(user_id).decode('utf-8') ).all();
예제 #24
0
파일: auth.py 프로젝트: tongpa/pypollmodel
 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()
예제 #25
0
 def getBySocial(cls,social_id, socialtype_id):
     return DBSession.query(cls).filter(cls.provider_user_id == str(social_id).decode('utf-8'), cls.id_social_type == str(socialtype_id).decode('utf-8') ).first();
예제 #26
0
 def getServerName(cls,serverName):
     return DBSession.query(cls).filter(cls.server_name == str(serverName).decode('utf-8') ).first()
예제 #27
0
 def getUserClientAuthen(cls,client_id,client_secret):
     return DBSession.query(cls).filter(cls.client_id == str(client_id).decode('utf-8'),cls.client_secret == str(client_secret).decode('utf-8'),cls.active == str('1').decode('utf-8')).first();
예제 #28
0
 def getAll(cls,active):
     return DBSession.query(cls).filter(cls.active == str(active).decode('utf-8')).all(); 
예제 #29
0
 def getAll(cls,act):
     if act is not None:
         return DBSession.query(cls).filter(cls.active == str(act).decode('utf-8')).all();
         #return DBSession.query(cls).get(act); 
     else:
         return DBSession.query(cls) .all();
예제 #30
0
 def getbyKey(cls,key):
     return DBSession.query(cls).filter(cls.environment_key  == str(key).decode('utf-8') ,cls.active == str('1').decode('utf-8')).first();