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


Python L10n.is_defined方法代码示例

本文整理汇总了Python中dNG.data.text.l10n.L10n.is_defined方法的典型用法代码示例。如果您正苦于以下问题:Python L10n.is_defined方法的具体用法?Python L10n.is_defined怎么用?Python L10n.is_defined使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dNG.data.text.l10n.L10n的用法示例。


在下文中一共展示了L10n.is_defined方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: execute_error

# 需要导入模块: from dNG.data.text.l10n import L10n [as 别名]
# 或者: from dNG.data.text.l10n.L10n import is_defined [as 别名]
    def execute_error(self):
        """
Action for "error"

:since: v1.0.0
        """

        code = InputFilter.filter_int(self.request.get_parameter("code", "500"))

        if (L10n.is_defined("errors_pas_http_core_{0:d}".format(code))):
            if (self.response.is_supported("headers")):
                self.response.set_header("HTTP",
                                         ("HTTP/2.0 {0:d} {1}".format(code, self.error_messages[code])
                                          if (code in self.error_messages) else
                                          "HTTP/2.0 500 Internal Server Error"
                                         ),
                                         True
                                        )
            #

            self.response.handle_error("pas_http_core_{0:d}".format(code))
        else:
            if (self.response.is_supported("headers")): self.response.set_header("HTTP", "HTTP/2.0 500 Internal Server Error", True)
            self.response.handle_critical_error("core_unknown_error")
开发者ID:dNG-git,项目名称:pas_http_core,代码行数:26,代码来源:http.py

示例2: __init__

# 需要导入模块: from dNG.data.text.l10n import L10n [as 别名]
# 或者: from dNG.data.text.l10n.L10n import is_defined [as 别名]
    def __init__(self):
        """
Constructor __init__(ControlPoint)

:since: v0.2.00
        """

        AbstractTimed.__init__(self)

        self.bootid = 0
        """
UPnP bootId value (bootid.upnp.org); nextbootid.upnp.org += 1
        """
        self.configid = 0
        """
UPnP configId value (configid.upnp.org)
        """
        self.devices = { }
        """
List of devices with its services
        """
        self.gena = None
        """
UPnP GENA manager
        """
        self.http_host = None
        """
HTTP Accept-Language value
        """
        self.http_language = (L10n.get("lang_rfc_region") if (L10n.is_defined("lang_rfc_region")) else None)
        """
HTTP Accept-Language value
        """
        self.http_port = None
        """
HTTP Accept-Language value
        """
        self.listener_ipv4 = None
        """
Unicast IPv4 listener
        """
        self.listener_port = int(Settings.get("pas_upnp_device_port", 1900))
        """
Unicast port in the range 49152-65535 (searchport.upnp.org)
        """
        self.listeners_multicast = { }
        """
Multicast listeners
        """
        self.listeners_multicast_ipv4 = 0
        """
Number of IPv4 multicast listeners
        """
        self.listeners_multicast_ipv6 = 0
        """
Number of IPv6 multicast listeners
        """
        self.managed_devices = { }
        """
List of managed devices
        """
        self.rootdevices = [ ]
        """
List of UPnP root devices
        """
        self.tasks = [ ]
        """
List of tasks (e.g. timed out services) to run
        """
        self.upnp_desc = { }
        """
Received UPnP descriptions
        """
        self.upnp_desc_unread = { }
        """
Unread UPnP description URLs
        """
        self.usns = { }
        """
List of devices with its services
        """

        Settings.read_file("{0}/settings/pas_upnp.json".format(Settings.get("path_data")))

        self.log_handler = NamedLoader.get_singleton("dNG.data.logging.LogHandler", False)

        if (self.http_language is None):
            system_language = getlocale()[0]

            http_language = (Settings.get("core_lang", "en_US")
                             if (system_language is None or system_language == "c") else
                             system_language
                            )

            http_language = http_language.replace("_", "")
            http_language = re.sub("\\W", "", http_language)
        else: http_language = self.http_language.replace("_", "")

        if (Settings.is_defined("core_lang_{0}".format(http_language))): http_language = Settings.get("core_lang_{0}".format(http_language))
        elif (Settings.is_defined("core_lang_{0}".format(http_language[:2]))): http_language = Settings.get("core_lang_{0}".format(http_language[:2]))
#.........这里部分代码省略.........
开发者ID:dNG-git,项目名称:pas_upnp,代码行数:103,代码来源:control_point.py


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