當前位置: 首頁>>代碼示例>>Python>>正文


Python locale.setter方法代碼示例

本文整理匯總了Python中tornado.locale.setter方法的典型用法代碼示例。如果您正苦於以下問題:Python locale.setter方法的具體用法?Python locale.setter怎麽用?Python locale.setter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tornado.locale的用法示例。


在下文中一共展示了locale.setter方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: locale

# 需要導入模塊: from tornado import locale [as 別名]
# 或者: from tornado.locale import setter [as 別名]
def locale(self):
        """返回當前session的位置.

        通過 `get_user_locale` 來確定, 你可以複寫這個方法設置
        獲取locale的條件, e.g., 記錄在數據庫中的用戶偏好, 或
        `get_browser_locale`, 使用 ``Accept-Language`` 頭部.

        .. versionchanged: 4.1
           添加setter屬性.
        """
        if not hasattr(self, "_locale"):
            self._locale = self.get_user_locale()
            if not self._locale:
                self._locale = self.get_browser_locale()
                assert self._locale
        return self._locale 
開發者ID:tao12345666333,項目名稱:tornado-zh,代碼行數:18,代碼來源:web.py

示例2: locale

# 需要導入模塊: from tornado import locale [as 別名]
# 或者: from tornado.locale import setter [as 別名]
def locale(self) -> tornado.locale.Locale:
        """The locale for the current session.

        Determined by either `get_user_locale`, which you can override to
        set the locale based on, e.g., a user preference stored in a
        database, or `get_browser_locale`, which uses the ``Accept-Language``
        header.

        .. versionchanged: 4.1
           Added a property setter.
        """
        if not hasattr(self, "_locale"):
            loc = self.get_user_locale()
            if loc is not None:
                self._locale = loc
            else:
                self._locale = self.get_browser_locale()
                assert self._locale
        return self._locale 
開發者ID:opendevops-cn,項目名稱:opendevops,代碼行數:21,代碼來源:web.py

示例3: locale

# 需要導入模塊: from tornado import locale [as 別名]
# 或者: from tornado.locale import setter [as 別名]
def locale(self):
        """The locale for the current session.

        Determined by either `get_user_locale`, which you can override to
        set the locale based on, e.g., a user preference stored in a
        database, or `get_browser_locale`, which uses the ``Accept-Language``
        header.

        .. versionchanged: 4.1
           Added a property setter.
        """
        if not hasattr(self, "_locale"):
            self._locale = self.get_user_locale()
            if not self._locale:
                self._locale = self.get_browser_locale()
                assert self._locale
        return self._locale 
開發者ID:tp4a,項目名稱:teleport,代碼行數:19,代碼來源:web.py


注:本文中的tornado.locale.setter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。