本文整理匯總了Python中lib.GlobalData.userBackend方法的典型用法代碼示例。如果您正苦於以下問題:Python GlobalData.userBackend方法的具體用法?Python GlobalData.userBackend怎麽用?Python GlobalData.userBackend使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類lib.GlobalData
的用法示例。
在下文中一共展示了GlobalData.userBackend方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ValueError
# 需要導入模塊: from lib import GlobalData [as 別名]
# 或者: from lib.GlobalData import userBackend [as 別名]
updateEmailNotification = (str(
configRoot.find("update").find("general").attrib[
"emailNotification"]).upper() == "TRUE")
# email notification works only if smtp is activated
if (updateEmailNotification is True
and smtpActivated is False):
raise ValueError("Update check can not have email "
+ "notification activated when smtp is not activated.")
# configure user credentials backend
userBackendMethod = str(
configRoot.find("storage").find("userBackend").attrib[
"method"]).upper()
if userBackendMethod == "CSV":
globalData.userBackend = CSVBackend(globalData.userBackendCsvFile)
else:
raise ValueError("No valid user backend method in config file.")
# configure storage backend (check which backend is configured)
userBackendMethod = str(
configRoot.find("storage").find("storageBackend").attrib[
"method"]).upper()
if userBackendMethod == "SQLITE":
globalData.storage = Sqlite(globalData.storageBackendSqliteFile,
globalData.version)
elif userBackendMethod == "MYSQL":
backendUsername = str(configRoot.find("storage").find(