當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。