Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Private Attributes
MoinMoin.support.werkzeug.datastructures.ETags Class Reference

List of all members.

Public Member Functions

def __init__
def as_set
def is_weak
def contains_weak
def contains
def contains_raw
def to_header
def __call__
def __nonzero__
def __str__
def __iter__
def __contains__
def __repr__

Public Attributes

 star_tag

Private Attributes

 _strong
 _weak

Detailed Description

A set that can be used to check if one etag is present in a collection
of etags.

Definition at line 1654 of file datastructures.py.


Constructor & Destructor Documentation

def MoinMoin.support.werkzeug.datastructures.ETags.__init__ (   self,
  strong_etags = None,
  weak_etags = None,
  star_tag = False 
)

Definition at line 1659 of file datastructures.py.

01659 
01660     def __init__(self, strong_etags=None, weak_etags=None, star_tag=False):
01661         self._strong = frozenset(not star_tag and strong_etags or ())
01662         self._weak = frozenset(weak_etags or ())
01663         self.star_tag = star_tag


Member Function Documentation

def MoinMoin.support.werkzeug.datastructures.ETags.__call__ (   self,
  etag = None,
  data = None,
  include_weak = False 
)

Definition at line 1704 of file datastructures.py.

01704 
01705     def __call__(self, etag=None, data=None, include_weak=False):
01706         if [etag, data].count(None) != 1:
01707             raise TypeError('either tag or data required, but at least one')
01708         if etag is None:
01709             etag = generate_etag(data)
01710         if include_weak:
01711             if etag in self._weak:
01712                 return True
01713         return etag in self._strong

Here is the call graph for this function:

Definition at line 1723 of file datastructures.py.

01723 
01724     def __contains__(self, etag):
01725         return self.contains(etag)

Here is the call graph for this function:

Definition at line 1720 of file datastructures.py.

01720 
01721     def __iter__(self):
01722         return iter(self._strong)

Definition at line 1714 of file datastructures.py.

01714 
01715     def __nonzero__(self):
01716         return bool(self.star_tag or self._strong)

Definition at line 1726 of file datastructures.py.

01726 
01727     def __repr__(self):
01728         return '<%s %r>' % (self.__class__.__name__, str(self))
01729 

Definition at line 1717 of file datastructures.py.

01717 
01718     def __str__(self):
01719         return self.to_header()

Here is the call graph for this function:

def MoinMoin.support.werkzeug.datastructures.ETags.as_set (   self,
  include_weak = False 
)
Convert the `ETags` object into a python set.  Per default all the
weak etags are not part of this set.

Definition at line 1664 of file datastructures.py.

01664 
01665     def as_set(self, include_weak=False):
01666         """Convert the `ETags` object into a python set.  Per default all the
01667         weak etags are not part of this set."""
01668         rv = set(self._strong)
01669         if include_weak:
01670             rv.update(self._weak)
01671         return rv

Check if an etag is part of the set ignoring weak tags.

Definition at line 1680 of file datastructures.py.

01680 
01681     def contains(self, etag):
01682         """Check if an etag is part of the set ignoring weak tags."""
01683         if self.star_tag:
01684             return True
01685         return etag in self._strong

Here is the caller graph for this function:

When passed a quoted tag it will check if this tag is part of the
set.  If the tag is weak it is checked against weak and strong tags,
otherwise weak only.

Definition at line 1686 of file datastructures.py.

01686 
01687     def contains_raw(self, etag):
01688         """When passed a quoted tag it will check if this tag is part of the
01689         set.  If the tag is weak it is checked against weak and strong tags,
01690         otherwise weak only."""
01691         etag, weak = unquote_etag(etag)
01692         if weak:
01693             return self.contains_weak(etag)
01694         return self.contains(etag)

Here is the call graph for this function:

Check if an etag is part of the set including weak and strong tags.

Definition at line 1676 of file datastructures.py.

01676 
01677     def contains_weak(self, etag):
01678         """Check if an etag is part of the set including weak and strong tags."""
01679         return self.is_weak(etag) or self.contains(etag)

Here is the call graph for this function:

Here is the caller graph for this function:

Check if an etag is weak.

Definition at line 1672 of file datastructures.py.

01672 
01673     def is_weak(self, etag):
01674         """Check if an etag is weak."""
01675         return etag in self._weak

Here is the caller graph for this function:

Convert the etags set into a HTTP header string.

Definition at line 1695 of file datastructures.py.

01695 
01696     def to_header(self):
01697         """Convert the etags set into a HTTP header string."""
01698         if self.star_tag:
01699             return '*'
01700         return ', '.join(
01701             ['"%s"' % x for x in self._strong] +
01702             ['w/"%s"' % x for x in self._weak]
01703         )

Here is the caller graph for this function:


Member Data Documentation

Definition at line 1660 of file datastructures.py.

Definition at line 1661 of file datastructures.py.

Definition at line 1662 of file datastructures.py.


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