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


Python HeaderKeyDict.keys方法代码示例

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


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

示例1: _clean_outgoing_headers

# 需要导入模块: from swift.common.swob import HeaderKeyDict [as 别名]
# 或者: from swift.common.swob.HeaderKeyDict import keys [as 别名]
    def _clean_outgoing_headers(self, headers):
        """
        Removes any headers as per the middleware configuration for
        outgoing responses.

        :param headers: A WSGI start_response style list of headers,
                        [('header1', 'value), ('header2', 'value),
                         ...]
        :returns: The same headers list, but with some headers
                  removed as per the middlware configuration for
                  outgoing responses.
        """
        headers = HeaderKeyDict(headers)
        for h in headers.keys():
            remove = h in self.outgoing_remove_headers
            if not remove:
                for p in self.outgoing_remove_headers_startswith:
                    if h.startswith(p):
                        remove = True
                        break
            if remove:
                if h in self.outgoing_allow_headers:
                    remove = False
            if remove:
                for p in self.outgoing_allow_headers_startswith:
                    if h.startswith(p):
                        remove = False
                        break
            if remove:
                del headers[h]
        return headers.items()
开发者ID:lielongxingkong,项目名称:windchimes,代码行数:33,代码来源:tempurl.py


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