changeset 4820:17e9325712b3

Groups2009: Group __contains__ also checks if a group contains another group.
author Dmitrijs Milajevs <dimazest@gmail.com>
date Thu, 25 Jun 2009 12:55:21 +0200
parents 05a605c107ed
children fe472a24fbcc
files MoinMoin/groups/backends/__init__.py MoinMoin/groups/backends/_tests/__init__.py
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/groups/backends/__init__.py	Thu Jun 25 12:42:55 2009 +0200
+++ b/MoinMoin/groups/backends/__init__.py	Thu Jun 25 12:55:21 2009 +0200
@@ -53,7 +53,7 @@
         """
         processed_groups.add(self.name)
 
-        if member in self.members:
+        if member in self.members or member in self.member_groups:
             return True
         else:
             groups = self.request.groups
--- a/MoinMoin/groups/backends/_tests/__init__.py	Thu Jun 25 12:42:55 2009 +0200
+++ b/MoinMoin/groups/backends/_tests/__init__.py	Thu Jun 25 12:55:21 2009 +0200
@@ -49,6 +49,12 @@
 
         raises(GroupDoesNotExistError, lambda: groups[u'NotExistingGroup'])
 
+    def test_contains_group(self):
+        groups = self.request.groups
+
+        assert u'AdminGroup' in groups[u'EditorGroup']
+        assert u'EditorGroup' not in groups[u'AdminGroup']
+
     def test_iter(self):
         groups = self.request.groups