phpbb: Add docstrings to a few methods.
authorMatthijs Kooijman <matthijs@stdin.nl>
Fri, 2 Jul 2010 12:05:35 +0000 (14:05 +0200)
committerMatthijs Kooijman <matthijs@stdin.nl>
Fri, 2 Jul 2010 12:05:35 +0000 (14:05 +0200)
conf/auth/phpbb.py

index 3c1f80686a746a0b2d1cea319798a2cfed8b495c..5185eb3c345069eac3af6d02070b13a9e437deac 100644 (file)
@@ -17,9 +17,11 @@ logging = log.getLogger(__name__)
 
 class PhpbbGroupsBackend(LazyGroupsBackend):
     class PhpbbGroup(LazyGroup):
+        """
+        A group from phpbb.
+        """
         pass
 
-
     def __init__(self, request, auth):
         super(LazyGroupsBackend, self).__init__(request)
 
@@ -27,12 +29,18 @@ class PhpbbGroupsBackend(LazyGroupsBackend):
         self.request = request
 
     def __iter__(self):
+        """
+        Return a list of group names.
+        """
         return self.list_query("SELECT group_name \
                                 FROM `%sgroups` \
                                 WHERE group_single_user = 0"
                                 % self.auth.phpbb_prefix)
 
     def __contains__(self, group_name):
+        """
+        Does a group with the given name exist?
+        """
         return self.single_query("SELECT EXISTS ( \
                                       SELECT * \
                                       FROM `%sgroups` \
@@ -41,9 +49,16 @@ class PhpbbGroupsBackend(LazyGroupsBackend):
                                  group_name)
 
     def __getitem__(self, group_name):
+        """
+        Get the group with the given name.
+        """
         return self.PhpbbGroup(self.request, group_name, self)
 
     def _iter_group_members(self, group_name):
+        """
+        Get all member names for the given group. This is called by
+        LazyGroup.__iter__.
+        """
         return self.list_query ("SELECT username \
                                  FROM `%susers` as u, `%suser_group` as ug, `%sgroups` as g  \
                                  WHERE u.user_id = ug.user_id AND ug.group_id = g.group_id \
@@ -53,6 +68,10 @@ class PhpbbGroupsBackend(LazyGroupsBackend):
                                 group_name)
 
     def _group_has_member(self, group_name, member):
+        """
+        Does the group with the given name have a member with the given name?
+        This is called by LazyGroup.__contains__.
+        """
         return self.single_query ("SELECT EXISTS( \
                                        SELECT * \
                                        FROM `%susers` as u, `%suser_group` as ug, `%sgroups` as g \
@@ -63,6 +82,10 @@ class PhpbbGroupsBackend(LazyGroupsBackend):
                                   (group_name, member))
         
     def groups_with_member(self, member):
+        """
+        Return the group names for all groups that have a member with the
+        given name.
+        """
         return self.list_query ("SELECT g.group_name \
                                  FROM `%susers` as u, `%suser_group` as ug, `%sgroups` as g \
                                  WHERE u.user_id = ug.user_id AND ug.group_id = g.group_id \
@@ -201,6 +224,9 @@ class PhpbbAuth(BaseAuth):
         return conn
 
     def login(self, request, user_obj, **kw):
+        """
+        Handle a login. Called by moinmoin.
+        """
         try:
             username = kw.get('username')
             password = kw.get('password')