Ignore:
Timestamp:
22 Jun 2012, 10:40:31 (13 years ago)
Author:
Henrik Bettermann
Message:

Sort user list.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r8740 r8774  
    5757    IPasswordValidator, IContactForm, IKofaUtils, ICSVExporter,
    5858    IChangePassword)
    59 from waeup.kofa.permissions import get_users_with_local_roles, get_all_roles
     59from waeup.kofa.permissions import (
     60    get_users_with_local_roles, get_all_roles, get_all_users)
    6061from waeup.kofa.students.catalog import search as searchstudents
    6162from waeup.kofa.university.catalog import search
     
    15351536
    15361537    def getUsers(self):
    1537         """Get a list of all users.
    1538         """
    1539         for key, val in grok.getSite()['users'].items():
    1540             url = self.url(val)
    1541             yield(dict(url=url, name=key, val=val))
     1538        return get_all_users()
    15421539
    15431540    def getUsersWithLocalRoles(self):
     
    17221719
    17231720    def getUsers(self):
    1724         """Get a list of all users.
    1725         """
    1726         for key, val in grok.getSite()['users'].items():
    1727             url = self.url(val)
    1728             yield(dict(url=url, name=key, val=val))
     1721        return get_all_users()
    17291722
    17301723    def getUsersWithLocalRoles(self):
     
    19671960
    19681961    def getUsers(self):
    1969         """Get a list of all users.
    1970         """
    1971         for key, val in grok.getSite()['users'].items():
    1972             url = self.url(val)
    1973             yield(dict(url=url, name=key, val=val))
     1962        return get_all_users()
    19741963
    19751964    def getUsersWithLocalRoles(self):
  • main/waeup.kofa/trunk/src/waeup/kofa/permissions.py

    r8565 r8774  
    272272        return sorted(list_of_dict, key=lambda x: x['name'])
    273273
     274def get_all_users():
     275    """Get a list of dictionaries.
     276    """
     277    users = sorted(grok.getSite()['users'].items(), key=lambda x: x[1].title)
     278    for key, val in users:
     279        yield(dict(name=key, val=val))
     280
    274281def get_users_with_local_roles(context):
    275282    """Get a list of dicts representing the local roles set for `context`.
Note: See TracChangeset for help on using the changeset viewer.