Logo Search packages:      
Sourcecode: paste version File versions  Download package

paste::httpheaders::HTTPHeader Class Reference

Inheritance diagram for paste::httpheaders::HTTPHeader:

paste::httpheaders::_MultiEntryHeader paste::httpheaders::_MultiValueHeader paste::httpheaders::_SingleValueHeader paste::httpheaders::_AcceptRanges paste::httpheaders::_CacheControl paste::httpheaders::_Range paste::httpheaders::_Authorization paste::httpheaders::_ContentDisposition paste::httpheaders::_ContentLength paste::httpheaders::_ContentRange paste::httpheaders::_ContentType paste::httpheaders::_DateHeader

List of all members.


Detailed Description

an HTTP header

HTTPHeader instances represent a particular ``field-name`` of an
HTTP message header. They do not hold a field-value, but instead
provide operations that work on is corresponding values.  Storage
of the actual field values is done with WSGI ``environ`` or
``response_headers`` as appropriate.  Typically, a sub-classes that
represent a specific HTTP header, such as _ContentDisposition, are
0.  Once constructed the HTTPHeader instances themselves
are immutable and stateless.

For purposes of documentation a "container" refers to either a
WSGI ``environ`` dictionary, or a ``response_headers`` list.

Member variables (and correspondingly constructor arguments).

  ``name``

      the ``field-name`` of the header, in "common form"
      as presented in RFC 2616; e.g. 'Content-Type'

  ``category``

      one of 'general', 'request', 'response', or 'entity'

  ``version``

      version of HTTP (informational) with which the header should
      be recognized

  ``sort_order``

      sorting order to be applied before sorting on
      field-name when ordering headers in a response

Special Methods:

   ``__call__``

       The primary method of the HTTPHeader instance is to make
       it a callable, it takes either a collection, a string value,
       or keyword arguments and attempts to find/construct a valid
       field-value

   ``__lt__``

       This method is used so that HTTPHeader objects can be
       sorted in a manner suggested by RFC 2616.

   ``__str__``

       The string-value for instances of this class is
       the ``field-name``.

Primary Methods:

   ``delete()``

       remove the all occurrences (if any) of the given
       header in the collection provided

   ``update()``

       replaces (if they exist) all field-value items
       in the given collection with the value provided

   ``tuples()``

       returns a set of (field-name, field-value) tuples
       5 for extending ``response_headers``

Custom Methods (these may not be implemented):

   ``apply()``

       similar to ``update``, but with two differences; first,
       only keyword arguments can be used, and second, specific
       sub-classes may introduce side-effects

   ``parse()``

       converts a string value of the header into a more usable
       form, such as time in seconds for a date header, etc.

The collected versions of initialized header instances are immediately
registered and accessible through the ``get_header`` function.  Do not
inherit from this directly, use one of ``_SingleValueHeader``,
``_MultiValueHeader``, or ``_MultiEntryHeader`` as appropriate.

Definition at line 172 of file httpheaders.py.


Public Member Functions

def __call__
def __lt__
def __new__
def __repr__
def __str__
def apply
def compose
def delete
def parse
def tuples
def update
def values

Public Attributes

 category
 name
 reference
 sort_order
 version

Static Public Attributes

string category = 'general'
dictionary extensions = {}
string reference = ''
string version = '1.1'

Private Attributes

 _environ_name
 _headers_name

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index