changeset 2666:c04690fb2305

Fixed issue #447 rev.meta[NAME] is list and as such cannot be used as a key as it was being used earlier.
author Ajitesh Gupta <ajgupta93@gmail.com>
date Mon, 07 Jul 2014 19:33:52 +0530
parents 73adb7dfd1bd
children ccb13ba1308e
files MoinMoin/apps/admin/views.py
diffstat 1 files changed, 15 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/admin/views.py	Mon Jul 07 14:09:46 2014 +0530
+++ b/MoinMoin/apps/admin/views.py	Mon Jul 07 19:33:52 2014 +0530
@@ -46,13 +46,21 @@
     """
     groups = flaskg.groups
     revs = user.search_users()  # all users
-    user_accounts = [dict(uid=rev.meta[ITEMID],
-                          name=rev.meta[NAME],
-                          fqname=CompositeName(NAMESPACE_USERPROFILES, NAME_EXACT, rev.name),
-                          email=rev.meta[EMAIL] if EMAIL in rev.meta else rev.meta[EMAIL_UNVALIDATED],
-                          disabled=rev.meta[DISABLED],
-                          groups=[groupname for groupname in groups if rev.meta[NAME] in groups[groupname]],
-                     ) for rev in revs]
+    user_accounts = []
+    for rev in revs:
+        user_groups = []
+        user_names = rev.meta[NAME]
+        for groupname in groups:
+            group = groups[groupname]
+            for name in user_names:
+                if name in group:
+                    user_groups.append(groupname)
+        user_accounts.append(dict(uid=rev.meta[ITEMID],
+                                  name=user_names,
+                                  fqname=CompositeName(NAMESPACE_USERPROFILES, NAME_EXACT, rev.name),
+                                  email=rev.meta[EMAIL] if EMAIL in rev.meta else rev.meta[EMAIL_UNVALIDATED],
+                                  disabled=rev.meta[DISABLED],
+                                  groups=user_groups))
     return render_template('admin/userbrowser.html', user_accounts=user_accounts, title_name=_(u"Users"))