本文整理汇总了Python中headers.Headers方法的典型用法代码示例。如果您正苦于以下问题:Python headers.Headers方法的具体用法?Python headers.Headers怎么用?Python headers.Headers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类headers
的用法示例。
在下文中一共展示了headers.Headers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start_response
# 需要导入模块: import headers [as 别名]
# 或者: from headers import Headers [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
示例2: __init__
# 需要导入模块: import headers [as 别名]
# 或者: from headers import Headers [as 别名]
def __init__(self, cfgGl):
self.autoCompletion = autocompletion.AutoCompletion()
self.headers = headers.Headers()
self.locations = locations.Locations()
self.titles = titles.Titles()
self.scDict = spellcheck.Dict()
self.lines = [ Line(LB_LAST, SCENE) ]
self.cfgGl = cfgGl
self.cfg = config.Config()
# cursor position: line and column
self.line = 0
self.column = 0
# first line shown on screen. use getTopLine/setTopLine to access
# this.
self._topLine = 0
# Mark object if selection active, or None.
self.mark = None
# FIXME: document these
self.pages = [-1, 0]
self.pagesNoAdjust = [-1, 0]
# time when last paginated
self.lastPaginated = 0.0
# list of active auto-completion strings
self.acItems = None
# selected auto-completion item (only valid when acItems contains
# something)
self.acSel = -1
# max nr of auto comp items displayed at once
self.acMax = 10
# True if script has had changes done to it after
# load/save/creation.
self.hasChanged = False
# first/last undo objects (undo.Base)
self.firstUndo = None
self.lastUndo = None
# value of this, depending on the user's last action:
# undo: the undo object that was used
# redo: the next undo object from the one that was used
# anything else: None
self.currentUndo = None
# estimated amount of memory used by undo objects, in bytes
self.undoMemoryUsed = 0