FAS 'User List' not working in HEAD
Toshio Kuratomi
a.badger at gmail.com
Tue Dec 30 06:54:46 UTC 2008
Jon Stanley wrote:
> 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)
>
Would this be better?
--- a/fas/user.py
+++ b/fas/user.py
@@ -444,6 +444,8 @@
https://admin.fedoraproject.org/accounts/user/verifyemail/%s
else:
return dict(people=[], unapproved_people=[],
search=search)
+ else:
+ user = person[0]
if person[1] == 'approved':
approved.append(user)
(I'm on vacation, feel free to commit whichever you think is best.)
-Toshio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
Url : http://lists.fedoraproject.org/pipermail/infrastructure/attachments/20081229/a10a4004/attachment.bin
More information about the infrastructure
mailing list