changeset 4867:e3773a70a520

Groups2009: formatter.groups refactoring. Docstring improvement, some attributes of the formatter became internal.
author Dmitrijs Milajevs <dimazest@gmail.com>
date Sun, 19 Jul 2009 12:52:59 +0200
parents 0437b25ee607
children 2f087d85e97d
files MoinMoin/formatter/groups.py
diffstat 1 files changed, 19 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/formatter/groups.py	Sun Jul 19 12:40:25 2009 +0200
+++ b/MoinMoin/formatter/groups.py	Sun Jul 19 12:52:59 2009 +0200
@@ -11,48 +11,51 @@
 
 class Formatter(FormatterBase):
     """
-    Collect groups and format nothing
+    Collect members of a group and format nothing.
+
+    Group members are stored in the members attribute.
     """
 
     def __init__(self, request, **kw):
         FormatterBase.__init__(self, request, **kw)
-        self.bullet_list_level = 0
-        self.inside_link = False
+
         self.members = []
-        self.new_member = ''
+        self._bullet_list_level = 0
+        self._inside_link = False
+        self._new_member = ''
 
     def bullet_list(self, on, **kw):
         if on:
-            self.bullet_list_level += 1
+            self._bullet_list_level += 1
         else:
-            self.bullet_list_level -= 1
+            self._bullet_list_level -= 1
 
-        assert self.bullet_list_level >= 0
+        assert self._bullet_list_level >= 0
 
         return self.null()
 
     def listitem(self, on, **kw):
-        if self.bullet_list_level == 1:
+        if self._bullet_list_level == 1:
             if not on:
-                stripped_new_member = self.new_member.strip()
-                if stripped_new_member and not on:
+                stripped_new_member = self._new_member.strip()
+                if stripped_new_member:
                     self.members.append(stripped_new_member)
-            self.new_member = ''
+            self._new_member = ''
         return self.null()
 
     def text(self, text, **kw):
-        if self.bullet_list_level == 1 and not self.inside_link:
-            self.new_member += text
+        if self._bullet_list_level == 1 and not self._inside_link:
+            self._new_member += text
         return self.null()
 
     def pagelink(self, on, pagename='', page=None, **kw):
-        if self.bullet_list_level == 1:
-            self.inside_link = on
+        if self._bullet_list_level == 1:
+            self._inside_link = on
             if not on:
                 if not pagename and page:
                     pagename = page.page_name
                 pagename = wikiutil.normalize_pagename(pagename, self.request.cfg)
-                self.new_member += pagename
+                self._new_member += pagename
         return self.null()
 
     def null(self, *args, **kw):