Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Private Attributes
MoinMoin.datastruct.backends.composite_dicts.CompositeDicts Class Reference
Inheritance diagram for MoinMoin.datastruct.backends.composite_dicts.CompositeDicts:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.datastruct.backends.composite_dicts.CompositeDicts:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __getitem__
def __contains__
def __repr__
def is_dict_name
def get

Public Attributes

 request
 page_dict_regex

Private Attributes

 _backends

Detailed Description

Manage several dicts backends.

Definition at line 12 of file composite_dicts.py.


Constructor & Destructor Documentation

@param backends: list of dict backends which are used to get
         access to the dict definitions.

Definition at line 17 of file composite_dicts.py.

00017 
00018     def __init__(self, request, *backends):
00019         """
00020         @param backends: list of dict backends which are used to get
00021                          access to the dict definitions.
00022         """
00023         super(CompositeDicts, self).__init__(request)
00024         self._backends = backends


Member Function Documentation

Check if a dict called dict_name is available in any of the backends.

Reimplemented from MoinMoin.datastruct.backends.BaseDictsBackend.

Definition at line 36 of file composite_dicts.py.

00036 
00037     def __contains__(self, dict_name):
00038         """
00039         Check if a dict called dict_name is available in any of the backends.
00040         """
00041         for backend in self._backends:
00042             if dict_name in backend:
00043                 return True
00044         return False

Get a dict by its name. First match counts.

Reimplemented from MoinMoin.datastruct.backends.BaseDictsBackend.

Definition at line 25 of file composite_dicts.py.

00025 
00026     def __getitem__(self, dict_name):
00027         """
00028         Get a dict by its name. First match counts.
00029         """
00030         for backend in self._backends:
00031             try:
00032                 return backend[dict_name]
00033             except DictDoesNotExistError:
00034                 pass
00035         raise DictDoesNotExistError(dict_name)

Here is the caller graph for this function:

Definition at line 45 of file composite_dicts.py.

00045 
00046     def __repr__(self):
00047         return "<%s backends=%s>" % (self.__class__, self._backends)
00048 
def MoinMoin.datastruct.backends.BaseDictsBackend.get (   self,
  key,
  default = None 
) [inherited]
Return the dictionary named <key> if key is in the backend,
else default. If default is not given, it defaults to None, so
that this method never raises a DictDoesNotExistError.

Definition at line 329 of file __init__.py.

00329 
00330     def get(self, key, default=None):
00331         """
00332         Return the dictionary named <key> if key is in the backend,
00333         else default. If default is not given, it defaults to None, so
00334         that this method never raises a DictDoesNotExistError.
00335         """
00336         try:
00337             return self[key]
00338         except DictDoesNotExistError:
00339             return default
00340 

Here is the caller graph for this function:

def MoinMoin.datastruct.backends.BaseDictsBackend.is_dict_name (   self,
  name 
) [inherited]

Definition at line 311 of file __init__.py.

00311 
00312     def is_dict_name(self, name):
00313         return self.page_dict_regex.match(name)

Here is the caller graph for this function:


Member Data Documentation

Definition at line 23 of file composite_dicts.py.

Definition at line 309 of file __init__.py.

Definition at line 308 of file __init__.py.


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