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

python-fedora: fas1 API addition



This is mostly for the people developing python/TG apps that need to
talk to the Account System.

If you are querying fas1 using the fedora.accounts.fas module you may
want to look into porting to a new method I added and deployed over the
weekend.  The method is get_users() and it returns public information
about all the users in the FAS.  This is useful when you have to hit the
FAS for a lot of information about people -- for instance, querying the
FAS to map userid's to human_name for every person in your db.  In that
scenario you would have to spend a large amount of time waiting for the
db to respond to your queries if you had to send them as individual
requests via get_user_info().

This has recently become more of an issue since we're starting to create
app servers outside of the phx colo.  Those servers take more time to
contact the db server inside of phx which means every round trip to the
db server is more expensive.

Example usage[*]:

>>> from fedora.accounts.fas import AccountSystem
>>> fas = AccountSystem()
>>> userList = fas.get_users()
>>> print userList[100068]['username']
toshio
>>> userListByName = fas.get_users(keyField='username')
>>> print userListByName['toshio']['id']
100068

Refer to the docstring for more information:
$  pydoc fedora.accounts.fas.AccountSystem.get_users

[*] You'll need to be able to access the fedora-db-access file to
actually use this code.  Your TG app running under supervisor has that
permission but your regular user may not.

-Toshio

Attachment: signature.asc
Description: OpenPGP digital signature


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