FAS 'User List' not working in HEAD

Jon Stanley jonstanley at gmail.com
Tue Dec 23 02:26:05 UTC 2008


When you click on 'User List' in the left hand side of FAS, you get an
UnboundLocalError that 'user' is referenced before defined.  This is
the result of some code in list() in user.py that was modified to
allow the return of selected fields.  However, if the query does not
specify what fields are wanted, the 'user' variable is not defined.

I tried to define it at the end if it didn't exist with person[0], but
that didn't seem to work for some reason.  The patch below is a little
hackish, but functional.

index a00d5fa..819b25b 100644
--- a/fas/user.py
+++ b/fas/user.py
@@ -446,9 +446,15 @@
https://admin.fedoraproject.org/accounts/user/verifyemail/%s
                                 search=search)

             if person[1] == 'approved':
-                approved.append(user)
+                try:
+                    approved.append(user)
+                except UnboundLocalError:
+                    approved.append(person[0])
             else:
-                unapproved.append(user)
+                try:
+                    unapproved.append(user)
+                except UnboundLocalError:
+                    unapproved.append(person[0])

         if not (approved or unapproved):
             turbogears.flash(_("No users found matching '%s'") % search)




More information about the infrastructure mailing list