comparison MoinMoin/groups/backends/__init__.py @ 4813:8ce584105581

Groups2009: BaseGroup._load_group is shortened by using difference.
author Dmitrijs Milajevs <dimazest@gmail.com>
date Thu, 18 Jun 2009 15:09:54 +0200
parents 3c0ce322472a
children 7d8f51be2285
comparison
equal deleted inserted replaced
4812:a1018d829c3e 4813:8ce584105581
23 self._backend = backend 23 self._backend = backend
24 self.members, self.member_groups = self._load_group() 24 self.members, self.member_groups = self._load_group()
25 25
26 def _load_group(self): 26 def _load_group(self):
27 """ 27 """
28 Fill in self.members, self.member_groups with data retrieved from the backend. 28 Retrieve group data from the backend and filter it to members and group_members.
29 """ 29 """
30 members_final = set() 30 members_retrieved = set(self._backend._retrieve_members(self.name))
31 member_groups = set()
32 31
33 for member in self._backend._retrieve_members(self.name): 32 member_groups = set(member for member in members_retrieved if self._backend.is_group(member))
34 if self._backend.is_group(member): 33 members = members_retrieved - member_groups
35 member_groups.add(member)
36 else:
37 members_final.add(member)
38 34
39 return members_final, member_groups 35 return members, member_groups
40 36
41 def _contains(self, member, processed_groups): 37 def _contains(self, member, processed_groups):
42 """ 38 """
43 First check if <member> is part of this group and then check 39 First check if <member> is part of this group and then check
44 for every subgroup in this group. 40 for every subgroup in this group.