Re: FAS 'User List' not working in HEAD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Fedora-infrastructure-list mailing list
Fedora-infrastructure-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-infrastructure-list

[Index of Archives]     [Fedora Development]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux