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


Python util.is_hop_by_hop方法代碼示例

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


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

示例1: start_response

# 需要導入模塊: import util [as 別名]
# 或者: from util import is_hop_by_hop [as 別名]
def start_response(self, status, headers,exc_info=None):
        """'start_response()' callable as specified by PEP 333"""

        if exc_info:
            try:
                if self.headers_sent:
                    # Re-raise original exception if headers sent
                    raise exc_info[0], exc_info[1], exc_info[2]
            finally:
                exc_info = None        # avoid dangling circular ref
        elif self.headers is not None:
            raise AssertionError("Headers already set!")

        assert type(status) is StringType,"Status must be a string"
        assert len(status)>=4,"Status must be at least 4 characters"
        assert int(status[:3]),"Status message must begin w/3-digit code"
        assert status[3]==" ", "Status message must have a space after code"
        if __debug__:
            for name,val in headers:
                assert type(name) is StringType,"Header names must be strings"
                assert type(val) is StringType,"Header values must be strings"
                assert not is_hop_by_hop(name),"Hop-by-hop headers not allowed"
        self.status = status
        self.headers = self.headers_class(headers)
        return self.write 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:27,代碼來源:handlers.py


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