Back to index

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

List of all members.

Public Member Functions

def __init__
def __getitem__
def __iter__
def __contains__
def __repr__
def is_group_name
def groups_with_member
def get

Public Attributes

 request
 page_group_regex

Private Attributes

 _backends

Detailed Description

Manage several group backends.

Definition at line 17 of file composite_groups.py.


Constructor & Destructor Documentation

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

Definition at line 22 of file composite_groups.py.

00022 
00023     def __init__(self, request, *backends):
00024         """
00025         @param backends: list of group backends which are used to get
00026                          access to the group definitions.
00027         """
00028         super(CompositeGroups, self).__init__(request)
00029         self._backends = backends


Member Function Documentation

Check if a group called group_name is available in any of the backends.

@param group_name: name of the group [unicode]

Reimplemented from MoinMoin.datastruct.backends.BaseGroupsBackend.

Definition at line 57 of file composite_groups.py.

00057 
00058     def __contains__(self, group_name):
00059         """
00060         Check if a group called group_name is available in any of the backends.
00061 
00062         @param group_name: name of the group [unicode]
00063         """
00064         for backend in self._backends:
00065             if group_name in backend:
00066                 return True
00067         return False

Get a group by its name. First match counts.

Reimplemented from MoinMoin.datastruct.backends.BaseGroupsBackend.

Definition at line 30 of file composite_groups.py.

00030 
00031     def __getitem__(self, group_name):
00032         """
00033         Get a group by its name. First match counts.
00034         """
00035         for backend in self._backends:
00036             try:
00037                 return backend[group_name]
00038             except GroupDoesNotExistError:
00039                 pass
00040         raise GroupDoesNotExistError(group_name)

Here is the caller graph for this function:

Iterate over group names in all backends (filtering duplicates).

If a group with same name is defined in several backends, the
composite_groups backend yields only backend which is listed
earlier in self._backends.

Reimplemented from MoinMoin.datastruct.backends.BaseGroupsBackend.

Definition at line 41 of file composite_groups.py.

00041 
00042     def __iter__(self):
00043         """
00044         Iterate over group names in all backends (filtering duplicates).
00045 
00046         If a group with same name is defined in several backends, the
00047         composite_groups backend yields only backend which is listed
00048         earlier in self._backends.
00049         """
00050         yielded_groups = set()
00051 
00052         for backend in self._backends:
00053             for group_name in backend:
00054                 if group_name not in yielded_groups:
00055                     yield group_name
00056                     yielded_groups.add(group_name)

Reimplemented from MoinMoin.datastruct.backends.BaseGroupsBackend.

Definition at line 68 of file composite_groups.py.

00068 
00069     def __repr__(self):
00070         return "<%s backends=%s>" % (self.__class__, self._backends)
00071 
def MoinMoin.datastruct.backends.BaseGroupsBackend.get (   self,
  key,
  default = None 
) [inherited]
Return the group 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 GroupDoesNotExistError.

Definition at line 102 of file __init__.py.

00102 
00103     def get(self, key, default=None):
00104         """
00105         Return the group named <key> if key is in the backend, else
00106         default. If default is not given, it defaults to None, so that
00107         this method never raises a GroupDoesNotExistError.
00108         """
00109         try:
00110             return self[key]
00111         except GroupDoesNotExistError:
00112             return default
00113 

Here is the caller graph for this function:

List all group names of groups containing <member>.

@param member: member name [unicode]
@return: list of group names [unicode]

Definition at line 88 of file __init__.py.

00088 
00089     def groups_with_member(self, member):
00090         """
00091         List all group names of groups containing <member>.
00092 
00093         @param member: member name [unicode]
00094         @return: list of group names [unicode]
00095         """
00096         for group_name in self:
00097             try:
00098                 if member in self[group_name]:
00099                     yield group_name
00100             except GroupDoesNotExistError:
00101                 pass

def MoinMoin.datastruct.backends.BaseGroupsBackend.is_group_name (   self,
  member 
) [inherited]

Definition at line 59 of file __init__.py.

00059 
00060     def is_group_name(self, member):
00061         return self.page_group_regex.match(member)

Here is the caller graph for this function:


Member Data Documentation

Definition at line 28 of file composite_groups.py.

Definition at line 57 of file __init__.py.

Definition at line 56 of file __init__.py.


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