changeset 4838:d1996f3b59d5

Groups2009: retrieve_members renamed to retrieve_items for dict backends. Cosmetic docstring changes.
author Dmitrijs Milajevs <dimazest@gmail.com>
date Wed, 08 Jul 2009 12:25:50 +0200
parents fc0c70fe84f3
children e8beef3218b9
files MoinMoin/datastruct/backends/__init__.py MoinMoin/datastruct/backends/composite_dicts.py MoinMoin/datastruct/backends/config_dicts.py MoinMoin/datastruct/backends/wiki_dicts.py
diffstat 4 files changed, 15 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/datastruct/backends/__init__.py	Sat Jul 04 17:43:38 2009 +0100
+++ b/MoinMoin/datastruct/backends/__init__.py	Wed Jul 08 12:25:50 2009 +0200
@@ -28,7 +28,6 @@
         @param request
         @param name: moin group name
         @backend: backend object which created this object
-
         """
         self.request = request
         self.name = name
@@ -178,7 +177,6 @@
         @param request
         @param name: moin dict name
         @backend: backend object which created this object
-
         """
         self.request = request
         self.name = name
@@ -201,7 +199,7 @@
         """
         Retrieve dict data from the backend.
         """
-        return self._backend._retrieve_members(self.name)
+        return self._backend._retrieve_items(self.name)
 
     def __repr__(self):
         return "<%r name=%r items=%r>" % (self.__class__, self.name, self._dict.items())
@@ -228,6 +226,6 @@
         """
         raise NotImplementedError()
 
-    def _retrieve_members(self, dict_name):
+    def _retrieve_items(self, dict_name):
         raise NotImplementedError()
 
--- a/MoinMoin/datastruct/backends/composite_dicts.py	Sat Jul 04 17:43:38 2009 +0100
+++ b/MoinMoin/datastruct/backends/composite_dicts.py	Wed Jul 08 12:25:50 2009 +0200
@@ -16,17 +16,15 @@
 
     def __init__(self, request, *backends):
         """
-        @param backends: list of group backends which are used to get
-                         access to the group definitions.
+        @param backends: list of dict backends which are used to get
+                         access to the dict definitions.
         """
         super(CompositeDicts, self).__init__(request)
         self._backends = backends
 
     def __getitem__(self, dict_name):
         """
-        Get a group by its name. First match counts.
-
-        @param group_name: name of the group [unicode]
+        Get a dict by its name. First match counts.
         """
         for backend in self._backends:
             if dict_name in backend:
@@ -36,8 +34,6 @@
     def __contains__(self, dict_name):
         """
         Check if a dict called dict_name is available in any of the backends.
-
-        @param dict_name: name of the dict [unicode]
         """
         for backend in self._backends:
             if dict_name in backend:
--- a/MoinMoin/datastruct/backends/config_dicts.py	Sat Jul 04 17:43:38 2009 +0100
+++ b/MoinMoin/datastruct/backends/config_dicts.py	Wed Jul 08 12:25:50 2009 +0200
@@ -31,7 +31,7 @@
     def __getitem__(self, dict_name):
         return ConfigDict(request=self.request, name=dict_name, backend=self)
 
-    def _retrieve_members(self, dict_name):
+    def _retrieve_items(self, dict_name):
         try:
             return self._dicts[dict_name]
         except KeyError:
--- a/MoinMoin/datastruct/backends/wiki_dicts.py	Sat Jul 04 17:43:38 2009 +0100
+++ b/MoinMoin/datastruct/backends/wiki_dicts.py	Wed Jul 08 12:25:50 2009 +0200
@@ -17,9 +17,10 @@
 
 
 class WikiDict(BaseDict):
-    """ Mapping of keys to values in a wiki page.
+    """
+    Mapping of keys to values in a wiki page.
 
-       How a Dict definition page should look like:
+    A dict definition page should look like:
 
        any text ignored
         key1:: value1
@@ -58,11 +59,12 @@
 
 
 class WikiDicts(BaseDictsBackend):
-    """ a dictionary of Dict objects
+    """
+    A dictionary of Dict objects
 
-       Config:
-           cfg.page_dict_regex
-               Default: ".*Dict$"  Defs$ Vars$ ???????????????????
+    Config:
+       cfg.page_dict_regex
+       Default: ".*Dict$"  Defs$ Vars$ ???????????????????
     """
 
     # Key:: Value - ignore all but key:: value pairs, strip whitespace, exactly one space after the :: is required
@@ -74,7 +76,7 @@
     def __getitem__(self, dict_name):
         return WikiDict(request=self.request, name=dict_name, backend=self)
 
-    def _retrieve_members(self, dict_name):
+    def _retrieve_items(self, dict_name):
         page = Page(self.request, dict_name)
         text = page.get_raw_body()
         return dict([match.groups() for match in self._dict_page_parse_regex.finditer(text)])