Beispiel #1
0
def CheckUser(Username, Pword):
    checksess = Session();
    user = checksess.query(Userinfo).filter(Userinfo.Username == Username).all()
    checksess.commit()
    checksess.close()

    if len(user) > 0:
        if (Pword == user[0].Password):
            return True
        else:
            return False
    else:
        return False
    return False
Beispiel #2
0
def AddUserDetail(UserId, UserNickName, Country, Aboutme, Age, InterestArea,height,weight,isF,occupation):
    from datetime import datetime
    sess = Session()
    birthFormat='%Y-%m-%d'
    ageRange = sess.query(AgeRange).filter(AgeRange.AgeRangeStart < Age and AgeRange.AgeRangeEnd < Age)
    detail = Userdetails(UserID=UserId, AliasName=UserNickName, Country=Country, About_me=Aboutme,
                         Agerange=ageRange[0].ID, InterestArea=InterestArea, Update_Date=datetime.utcnow(),
                         Height=height, Weight=weight, Brithday=datetime.strftime(birthFormat),Gender=(isF),
                         Occupation=occupation)
    try:
        sess.add(detail)
        sess.commit()
    except:
        print "Unexpect Exception:", sys.exc_info()[0]
        sess.rollback()
        sess.close()
        return False
    sess.close()
    return True