本文整理汇总了Python中models.DBSession.close方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.close方法的具体用法?Python DBSession.close怎么用?Python DBSession.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.DBSession
的用法示例。
在下文中一共展示了DBSession.close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getUserPassword
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import close [as 别名]
def getUserPassword(user):
res = ""
mySession = DBSession()
result = mySession.query(User).filter_by(user_name = user).first()
if not result is None:
res = decodeData(result.user_password)
mySession.close()
return res
示例2: getAPIKey
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import close [as 别名]
def getAPIKey(self):
key = ""
mySession = DBSession()
result = mySession.query(userModel).filter_by(user_name = self.login).first()
if not result is None:
key = result.user_apikey
mySession.close()
return key
示例3: getCountryName
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import close [as 别名]
def getCountryName(cnty_cod):
res = ""
mySession = DBSession()
result = mySession.query(Lkpcountry).filter_by(cnty_cod = cnty_cod).first()
if not result is None:
res = result.cnty_name
mySession.close()
return res
示例4: getSectorName
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import close [as 别名]
def getSectorName(sector_cod):
res = ""
mySession = DBSession()
result = mySession.query(Lkpsector).filter_by(sector_cod = sector_cod).first()
if not result is None:
res = result.sector_name
mySession.close()
return res
示例5: userExists
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import close [as 别名]
def userExists(user):
res = False
mySession = DBSession()
result = mySession.query(User).filter_by(user_name = user).first()
if not result is None:
res = True
mySession.close()
return res
示例6: otherUserHasEmail
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import close [as 别名]
def otherUserHasEmail(user,email):
res = False
mySession = DBSession()
result = mySession.query(User).filter(User.user_name != user).filter_by(user_email = email).first()
if not result is None:
res = True
mySession.close()
return res
示例7: getUserWithKey
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import close [as 别名]
def getUserWithKey(key):
res = ""
mySession = DBSession()
result = mySession.query(User).filter_by(user_apikey = key).first()
if not result is None:
res = result.user_name
mySession.close()
return res
示例8: getUserData
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import close [as 别名]
def getUserData(user):
res = None
mySession = DBSession()
result = mySession.query(userModel).filter_by(user_name = user).filter_by(user_active = 1).first()
if not result is None:
res = User(result.user_name,"",result.user_fullname,result.user_organization,result.user_email,result.user_cnty,result.user_sector,result.user_about)
mySession.close()
return res
示例9: getSectorList
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import close [as 别名]
def getSectorList():
sectors = []
mySession = DBSession()
results = mySession.query(Lkpsector).all()
for result in results:
sectors.append({"code": str(result.sector_cod), "name": result.sector_name})
mySession.close()
return sectors
示例10: emailExists
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import close [as 别名]
def emailExists(email):
res = False
mySession = DBSession()
result = mySession.query(User).filter_by(user_email = email).first()
if not result is None:
res = True
mySession.close()
return res
示例11: getAPILog
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import close [as 别名]
def getAPILog(requestID):
res = ""
mySession = DBSession()
result = mySession.query(Apilog).filter_by(log_uuid = requestID).first()
if not result is None:
res = result.log_id
mySession.close()
return res
示例12: getAPIInfo
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import close [as 别名]
def getAPIInfo(logID):
res = {}
mySession = DBSession()
result = mySession.query(Apilog).filter_by(log_id = logID).first()
if not result is None:
res["log_datetime"] = result.log_datetime
res["log_ip"] = result.log_ip
mySession.close()
return res
示例13: addToLog
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import close [as 别名]
def addToLog(log_user,log_type,log_message):
mySession = DBSession()
newLog = Activitylog(log_user,log_type,log_message)
try:
transaction.begin()
mySession.add(newLog) #Add the new log to MySQL
transaction.commit()
mySession.close()
except:
transaction.abort()
mySession.close()
示例14: getCountryList
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import close [as 别名]
def getCountryList():
countries = []
mySession = DBSession()
results = mySession.query(Lkpcountry).all()
for result in results:
try:
name = unicode(result.cnty_name.decode("cp1252").encode("utf-8"))
countries.append({"code": result.cnty_cod, "name": name})
except:
countries.append({"code": result.cnty_cod, "name": "Unknown"})
mySession.close()
return countries
示例15: changeUserPassword
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import close [as 别名]
def changeUserPassword(user,password):
mySession = DBSession()
try:
transaction.begin()
mySession.query(User).filter_by(user_name = user).update({"user_password": encodeData(password)})
transaction.commit()
mySession.close()
return True
except:
transaction.abort()
mySession.close()
return False