本文整理汇总了Python中dbclient.DbClient.updateContactList方法的典型用法代码示例。如果您正苦于以下问题:Python DbClient.updateContactList方法的具体用法?Python DbClient.updateContactList怎么用?Python DbClient.updateContactList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dbclient.DbClient
的用法示例。
在下文中一共展示了DbClient.updateContactList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: servePage
# 需要导入模块: from dbclient import DbClient [as 别名]
# 或者: from dbclient.DbClient import updateContactList [as 别名]
def servePage(self, view, url, params):
if url == "/edit":
selectedLang = params.get('lang', None)
if selectedLang and len(selectedLang) == 2:
Config.setProperty(Config.KEY_LANGUAGE, selectedLang)
# I18nManager will be triggered here because it listens to the Config
fsf = params.get('friendsseefriends', None)
friendsseefriends = fsf is not None and len(fsf) > 0
Config.setProperty(Config.KEY_ALLOW_FRIENDS_TO_SEE_FRIENDS, friendsseefriends)
slw = params.get('showlogwindow', None)
showlogwindow = slw is not None and len(slw) > 0
Config.setProperty(Config.KEY_SHOW_LOG_WINDOW, showlogwindow)
# If Config has changed, may need to update profile to include/hide friends info
DbClient.updateContactList(friendsseefriends)
# When friends are notified next time, the profile's hash will be calculated and sent
afw = params.get('allowfriendrequests', None)
allowfriendrequests = afw is not None and len(afw) > 0
Config.setProperty(Config.KEY_ALLOW_FRIEND_REQUESTS, allowfriendrequests)
# Save config to file in case it's changed
Config.save()
contents = self.buildPage({'pageTitle' : I18nManager.getText("settings.title"),
'pageBody' : "<p>Settings changed... should I go back to settings or back to home now?</p>",
'pageFooter' : "<p>Footer</p>"})
view.setHtml(contents)
else:
pageProps = {"friendsseefriends" : "checked" if Config.getProperty(Config.KEY_ALLOW_FRIENDS_TO_SEE_FRIENDS) else "",
"allowfriendrequests" : "checked" if Config.getProperty(Config.KEY_ALLOW_FRIEND_REQUESTS) else "",
"showlogwindow" : "checked" if Config.getProperty(Config.KEY_SHOW_LOG_WINDOW) else "",
"language_en":"", "language_de":""}
pageProps["language_" + Config.getProperty(Config.KEY_LANGUAGE)] = "selected"
#print("body:", self.formtemplate.getHtml(pageProps))
contents = self.buildPage({'pageTitle' : I18nManager.getText("settings.title"),
'pageBody' : self.formtemplate.getHtml(pageProps),
'pageFooter' : "<p>Footer</p>"})
view.setHtml(contents)