Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions
MoinMoin.support.werkzeug.datastructures._CacheControl Class Reference
Inheritance diagram for MoinMoin.support.werkzeug.datastructures._CacheControl:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.support.werkzeug.datastructures._CacheControl:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def to_header
def __str__
def __repr__
def calls_update

Public Attributes

 on_update
 provided

Static Public Attributes

tuple no_cache = cache_property('no-cache', '*', None)
tuple no_store = cache_property('no-store', None, bool)
tuple max_age = cache_property('max-age', -1, int)
tuple no_transform = cache_property('no-transform', None, None)
tuple clear = calls_update('clear')
tuple pop = calls_update('pop')
tuple popitem = calls_update('popitem')
tuple setdefault = calls_update('setdefault')
tuple update = calls_update('update')

Private Member Functions

def _get_cache_value
def _set_cache_value
def _del_cache_value

Detailed Description

Subclass of a dict that stores values for a Cache-Control header.  It
has accessors for all the cache-control directives specified in RFC 2616.
The class does not differentiate between request and response directives.

Because the cache-control directives in the HTTP header use dashes the
python descriptors use underscores for that.

To get a header of the :class:`CacheControl` object again you can convert
the object into a string or call the :meth:`to_header` method.  If you plan
to subclass it and add your own items have a look at the sourcecode for
that class.

The following attributes are exposed:

`no_cache`, `no_store`, `max_age`, `max_stale`, `min_fresh`,
`no_transform`, `only_if_cached`, `public`, `private`, `must_revalidate`,
`proxy_revalidate`, and `s_maxage`

.. versionchanged:: 0.4

   setting `no_cache` or `private` to boolean `True` will set the implicit
   none-value which is ``*``:

   >>> cc = ResponseCacheControl()
   >>> cc.no_cache = True
   >>> cc
   <ResponseCacheControl 'no-cache'>
   >>> cc.no_cache
   '*'
   >>> cc.no_cache = None
   >>> cc
   <ResponseCacheControl ''>

Definition at line 1340 of file datastructures.py.


Constructor & Destructor Documentation

def MoinMoin.support.werkzeug.datastructures._CacheControl.__init__ (   self,
  values = (),
  on_update = None 
)

Reimplemented in MoinMoin.support.werkzeug.datastructures.CacheControl.

Definition at line 1380 of file datastructures.py.

01380 
01381     def __init__(self, values=(), on_update=None):
01382         dict.__init__(self, values or ())
01383         self.on_update = on_update
01384         self.provided = values is not None


Member Function Documentation

Definition at line 1427 of file datastructures.py.

01427 
01428     def __repr__(self):
01429         return '<%s %r>' % (
01430             self.__class__.__name__,
01431             self.to_header()
01432         )
01433 

Here is the call graph for this function:

Definition at line 1424 of file datastructures.py.

01424 
01425     def __str__(self):
01426         return self.to_header()

Here is the call graph for this function:

Used internally by the accessor properties.

Definition at line 1415 of file datastructures.py.

01415 
01416     def _del_cache_value(self, key):
01417         """Used internally by the accessor properties."""
01418         if key in self:
01419             del self[key]

def MoinMoin.support.werkzeug.datastructures._CacheControl._get_cache_value (   self,
  key,
  empty,
  type 
) [private]
Used internally by the accessor properties.

Definition at line 1385 of file datastructures.py.

01385 
01386     def _get_cache_value(self, key, empty, type):
01387         """Used internally by the accessor properties."""
01388         if type is bool:
01389             return key in self
01390         if key in self:
01391             value = self[key]
01392             if value is None:
01393                 return empty
01394             elif type is not None:
01395                 try:
01396                     value = type(value)
01397                 except ValueError:
01398                     pass
01399             return value

def MoinMoin.support.werkzeug.datastructures._CacheControl._set_cache_value (   self,
  key,
  value,
  type 
) [private]
Used internally by the accessor properties.

Definition at line 1400 of file datastructures.py.

01400 
01401     def _set_cache_value(self, key, value, type):
01402         """Used internally by the accessor properties."""
01403         if type is bool:
01404             if value:
01405                 self[key] = None
01406             else:
01407                 self.pop(key, None)
01408         else:
01409             if value is None:
01410                 self.pop(key)
01411             elif value is True:
01412                 self[key] = None
01413             else:
01414                 self[key] = value

Definition at line 135 of file datastructures.py.

00135 
00136     def calls_update(name):
00137         def oncall(self, *args, **kw):
00138             rv = getattr(super(UpdateDictMixin, self), name)(*args, **kw)
00139             if self.on_update is not None:
00140                 self.on_update(self)
00141             return rv
00142         oncall.__name__ = name
00143         return oncall

Convert the stored values into a cache control header.

Definition at line 1420 of file datastructures.py.

01420 
01421     def to_header(self):
01422         """Convert the stored values into a cache control header."""
01423         return dump_header(self)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 146 of file datastructures.py.

Definition at line 1377 of file datastructures.py.

Definition at line 1375 of file datastructures.py.

Definition at line 1376 of file datastructures.py.

Reimplemented from MoinMoin.support.werkzeug.datastructures.UpdateDictMixin.

Definition at line 1382 of file datastructures.py.

Definition at line 147 of file datastructures.py.

Definition at line 148 of file datastructures.py.

Definition at line 1383 of file datastructures.py.

Definition at line 149 of file datastructures.py.

Definition at line 150 of file datastructures.py.


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