4Suite API Documentation

Module Ft.Server.Server.Http.HeaderDict

MIME message header storage for HTTP
Copyright 2005 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/
Classes:
Globals:

Classes

class HeaderDict(dict)
A dictionary-like object for storing MIME-like message headers. Headers are stored in the object via regular dictionary interfaces. They are retrieved via str(), repr() or self.terse(), which returns a standard dict with duplicate headers merged into a comma-separated list of values (even when it is not OK to do so).
The reason this class is needed is because the dictionary interface of
the Message class of the rfc822 and mimetools modules allows each new
header to overwrite a previously-stored header with the same key. Our
HeaderDict class stores its header values as lists, so no data is lost.
Its keys are accessed case-insensitively and are always written out
in a normalized format where usually only the first letter of each
hyphen-separated word is capitalized. (Content-MD5, ETag, TE, and
WWW-Authenticate are exceptions to this rule). The str(obj)
representation prints the headers in a convenient format suitable for
printing in a MIME-like message.

Methods

__contains__(self, key)
# case-insensitive 'key in dict' lookup
Overrides: __contains__ from class dict
__delitem__(self, key)
# case-insensitive deletion: removes entire list
Overrides: __delitem__ from class dict
__getitem__(self, key)
# case-insensitive lookup
Overrides: __getitem__ from class dict
__init__(self, obj=None)
Overrides: __init__ from class dict
__iter__(self)
# case-insensitive 'for key in dict' iteration
Overrides: __iter__ from class dict
__repr__(self)
# string representations
Overrides: __repr__ from class dict
__setitem__(self, key, value)
# case-insensitive storage; appends to a list
Overrides: __setitem__ from class dict
__str__(self)
Overrides: __str__ from class dict
get(self, key, default=None)
# retrieve a value or default if no such key
Overrides: get from class dict
has_key(self, key)
# case-insensitive key lookup
Overrides: has_key from class dict
iteritems(self)
Overrides: iteritems from class dict
iterkeys = __iter__(self)
# case-insensitive 'for key in dict' iteration
Overrides: iterkeys from class dict
keys(self)
# normalize key names
Overrides: keys from class dict
terse(self)
# return a terse dictionary (duplicate headers in one comma-separated string) # this is for compatibility with functions want to read the header values as # a single string rather than as a python list of strings
update(self, dict_)
# append another dict or HeaderDict
Overrides: update from class dict

Methods inherited from class dict

__cmp__, __eq__, __ge__, __getattribute__, __gt__, __hash__, __le__, __len__, __lt__, __ne__, __new__, clear, copy, items, itervalues, pop, popitem, setdefault, values

Methods inherited from class object

__delattr__, __reduce__, __reduce_ex__, __setattr__

Members

__dict__ = <attribute '__dict__' of 'HeaderDict' objects>
__weakref__ = <attribute '__weakref__' of 'HeaderDict' objects>
forceCaps = {'content-md5': 'Content-MD5', 'etag': 'ETag', 'te': 'TE', 'www-authenticate': 'WWW-Authenticate'}

Members inherited from class dict

fromkeys

Members inherited from class object

__class__

Globals

generators = _Feature((2, 2, 0, 'alpha', 1), (2, 3, 0, 'final', 0), 4096)