当前位置: 首页>>代码示例>>Python>>正文


Python DbClient.updateContactList方法代码示例

本文整理汇总了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)
开发者ID:activityworkshop,项目名称:Murmeli,代码行数:37,代码来源:pages.py


注:本文中的dbclient.DbClient.updateContactList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。