Back to index

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

List of all members.

Public Member Functions

def __contains__
def __iter__
def __repr__

Public Attributes

 member_groups
 request
 name

Private Member Functions

def _load_group

Detailed Description

Definition at line 28 of file wiki_groups.py.


Member Function Documentation

def MoinMoin.datastruct.backends.GreedyGroup.__contains__ (   self,
  member,
  processed_groups = None 
) [inherited]
First check if <member> is part of this group and then check
for every subgroup in this group.

<processed_groups> is needed to avoid infinite recursion, if
groups are defined recursively.

@param member: member name [unicode]
@param processed_groups: groups which were checked for containment before [set]

Reimplemented from MoinMoin.datastruct.backends.BaseGroup.

Definition at line 190 of file __init__.py.

00190 
00191     def __contains__(self, member, processed_groups=None):
00192         """
00193         First check if <member> is part of this group and then check
00194         for every subgroup in this group.
00195 
00196         <processed_groups> is needed to avoid infinite recursion, if
00197         groups are defined recursively.
00198 
00199         @param member: member name [unicode]
00200         @param processed_groups: groups which were checked for containment before [set]
00201         """
00202 
00203         if processed_groups is None:
00204             processed_groups = set()
00205 
00206         processed_groups.add(self.name)
00207 
00208         if member in self.members or member in self.member_groups:
00209             return True
00210         else:
00211             groups = self.request.groups
00212             for group_name in self.member_groups:
00213                 if group_name not in processed_groups and group_name in groups and groups[group_name].__contains__(member, processed_groups):
00214                     return True
00215 
00216         return False

def MoinMoin.datastruct.backends.GreedyGroup.__iter__ (   self,
  yielded_members = None,
  processed_groups = None 
) [inherited]
Iterate first over members of this group, then over subgroups of this group.

<yielded_members> and <processed_groups> are needed to avoid infinite recursion.
This can happen if there are two groups like these:
   OneGroup: Something, OtherGroup
   OtherGroup: OneGroup, SomethingOther

@param yielded_members: members which have been already yielded before [set]
@param processed_groups: group names which have been iterated before [set]

Reimplemented from MoinMoin.datastruct.backends.BaseGroup.

Definition at line 217 of file __init__.py.

00217 
00218     def __iter__(self, yielded_members=None, processed_groups=None):
00219         """
00220         Iterate first over members of this group, then over subgroups of this group.
00221 
00222         <yielded_members> and <processed_groups> are needed to avoid infinite recursion.
00223         This can happen if there are two groups like these:
00224            OneGroup: Something, OtherGroup
00225            OtherGroup: OneGroup, SomethingOther
00226 
00227         @param yielded_members: members which have been already yielded before [set]
00228         @param processed_groups: group names which have been iterated before [set]
00229         """
00230 
00231         if processed_groups is None:
00232             processed_groups = set()
00233 
00234         if yielded_members is None:
00235             yielded_members = set()
00236 
00237         processed_groups.add(self.name)
00238 
00239         for member in self.members:
00240             if member not in yielded_members:
00241                 yielded_members.add(member)
00242                 yield member
00243 
00244         groups = self.request.groups
00245         for group_name in self.member_groups:
00246             if group_name not in processed_groups:
00247                 if group_name in groups:
00248                     for member in groups[group_name].__iter__(yielded_members, processed_groups):
00249                         yield member
00250                 else:
00251                     yield group_name

Definition at line 252 of file __init__.py.

00252 
00253     def __repr__(self):
00254         return "<%s name=%s members=%s member_groups=%s>" % (self.__class__,
00255                                                              self.name,
00256                                                              self.members,
00257                                                              self.member_groups)
00258 

Retrieve group data from the backend and filter it to members and group_members.

Reimplemented from MoinMoin.datastruct.backends.GreedyGroup.

Definition at line 30 of file wiki_groups.py.

00030 
00031     def _load_group(self):
00032         request = self.request
00033         group_name = self.name
00034 
00035         page = Page(request, group_name)
00036         if page.exists():
00037             arena = 'pagegroups'
00038             key = wikiutil.quoteWikinameFS(group_name)
00039             cache = caching.CacheEntry(request, arena, key, scope='wiki', use_pickle=True)
00040             try:
00041                 cache_mtime = cache.mtime()
00042                 page_mtime = wikiutil.version2timestamp(page.mtime_usecs())
00043                 # TODO: fix up-to-date check mtime granularity problems.
00044                 #
00045                 # cache_mtime is float while page_mtime is integer
00046                 # The comparision needs to be done on the lowest type of both
00047                 if int(cache_mtime) > int(page_mtime):
00048                     # cache is uptodate
00049                     return cache.content()
00050                 else:
00051                     raise caching.CacheError
00052             except caching.CacheError:
00053                 # either cache does not exist, is erroneous or not uptodate: recreate it
00054                 members, member_groups = super(WikiGroup, self)._load_group()
00055                 cache.update((members, member_groups))
00056                 return members, member_groups
00057         else:
00058             raise GroupDoesNotExistError(group_name)
00059 


Member Data Documentation

Definition at line 177 of file __init__.py.

Definition at line 39 of file __init__.py.

Definition at line 38 of file __init__.py.


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