changeset 4871:f486af162cdf

Groups2009: Doctstrings to the datastruct module were added. Copyright notice cleanup.
author Dmitrijs Milajevs <dimazest@gmail.com>
date Sun, 19 Jul 2009 15:51:20 +0200
parents eabd8725c940
children ab696b0a23f2
files MoinMoin/datastruct/backends/__init__.py MoinMoin/datastruct/backends/composite_groups.py MoinMoin/datastruct/backends/config_groups.py MoinMoin/datastruct/backends/wiki_groups.py
diffstat 4 files changed, 43 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/datastruct/backends/__init__.py	Sun Jul 19 14:51:27 2009 +0200
+++ b/MoinMoin/datastruct/backends/__init__.py	Sun Jul 19 15:51:20 2009 +0200
@@ -1,6 +1,6 @@
 # -*- coding: iso-8859-1 -*-
 """
-MoinMoin - base classes for datastruct backends.
+MoinMoin - base classes for datastructs.
 
 @copyright: 2009 MoinMoin:DmitrijsMilajevs
 @license: GPL, see COPYING for details
@@ -20,6 +20,10 @@
 
 
 class BaseGroup(object):
+    """
+    Group is something which stores members. Groups are immutable. A
+    member is some arbitrary entity name (Unicode object).
+    """
 
     def __init__(self, request, name, backend):
         """
@@ -41,6 +45,10 @@
 
 
 class BaseGroupsBackend(object):
+    """
+    Backend provides access to the group definitions for the other
+    MoinMoin code.
+    """
 
     def __init__(self, request):
         self.request = request
@@ -150,6 +158,11 @@
 
 
 class GreedyGroup(BaseGroup):
+    """
+    GreedyGroup gets all members during initialization and stores them internally.
+
+    Members of a group may be names of other groups.
+    """
 
     def __init__(self, request, name, backend):
 
--- a/MoinMoin/datastruct/backends/composite_groups.py	Sun Jul 19 14:51:27 2009 +0200
+++ b/MoinMoin/datastruct/backends/composite_groups.py	Sun Jul 19 15:51:20 2009 +0200
@@ -2,6 +2,11 @@
 """
 MoinMoin - group access via various backends.
 
+The composite_groups is a backend that does not have direct storage,
+but composes other backends to a new one, so group definitions are
+retrieved from several backends. This allows to mix different
+backends.
+
 @copyright: 2009 DmitrijsMilajevs
 @license: GPL, see COPYING for details
 """
@@ -25,8 +30,6 @@
     def __getitem__(self, group_name):
         """
         Get a group by its name. First match counts.
-
-        @param group_name: name of the group [unicode]
         """
         for backend in self._backends:
             try:
@@ -38,6 +41,10 @@
     def __iter__(self):
         """
         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.
         """
         yielded_groups = set()
 
--- a/MoinMoin/datastruct/backends/config_groups.py	Sun Jul 19 14:51:27 2009 +0200
+++ b/MoinMoin/datastruct/backends/config_groups.py	Sun Jul 19 15:51:20 2009 +0200
@@ -1,8 +1,9 @@
 # -*- coding: iso-8859-1 -*-
 """
-MoinMoin - config group backend
+MoinMoin - config groups backend
 
-The config group backend enables you to define groups in a configuration file.
+The config_groups backend enables one to define groups and their
+members in a configuration file.
 
 @copyright: 2009 MoinMoin:DmitrijsMilajevs
 @license: GPL, see COPYING for details
--- a/MoinMoin/datastruct/backends/wiki_groups.py	Sun Jul 19 14:51:27 2009 +0200
+++ b/MoinMoin/datastruct/backends/wiki_groups.py	Sun Jul 19 15:51:20 2009 +0200
@@ -2,13 +2,19 @@
 """
 MoinMoin - wiki group backend
 
-The wiki group backend enables you to define groups on wiki pages.  To
-find group pages, request.cfg.cache.page_group_regexact pattern is
-used.  To find group members, it parses these pages and extracts the
-first level list (wiki markup).
+The wiki_groups backend allows to define groups on wiki pages. See
+SystemPagesGroup as example of a group page.
+
+Normally, the name of the group page has to end with Group like
+FriendsGroup. This lets MoinMoin recognize it as a group. This default
+pattern could be changed (e.g. for non-english languages etc.), see
+HelpOnConfiguration.
+
+MoinMoin.formatter.groups is used to extract group members from a
+page.
+
 
 @copyright: 2008 MoinMoin:ThomasWaldmann,
-            2008 MoinMoin:MelitaMihaljevic,
             2009 MoinMoin:DmitrijsMilajevs
 @license: GPL, see COPYING for details
 """
@@ -54,12 +60,18 @@
         return self.is_group_name(group_name) and Page(self.request, group_name).exists()
 
     def __iter__(self):
+        """
+        To find group pages, request.cfg.cache.page_group_regexact pattern is used.
+        """
         return iter(self.request.rootpage.getPageList(user='', filter=self.page_group_regex.search))
 
     def __getitem__(self, group_name):
         return WikiGroup(request=self.request, name=group_name, backend=self)
 
     def _retrieve_members(self, group_name):
+        """
+        MoinMoin.formatter.groups is used to extract group members from a page.
+        """
         formatter = Formatter(self.request)
         page = Page(self.request, group_name, formatter=formatter)