345
345
def get_user(self, login, dry=False):
346
"""Given a login, returns a dictionary of the user's DB fields,
347
excluding the passhash field.
346
"""Given a login, returns a User object containing details looked up
349
349
Raises a DBException if the login is not found in the DB.
351
return self.get_single({"login": login}, "login",
351
userdict = self.get_single({"login": login}, "login",
352
352
self.login_getfields, self.login_primary,
353
353
error_notfound="get_user: No user with that login name", dry=dry)
355
return userdict # Query string
356
# Package into a User object
357
return user.User(**userdict)
355
359
def get_users(self, dry=False):
356
"""Returns a list of all users. The list elements are a dictionary of
357
the user's DB fields, excluding the passhash field.
360
"""Returns a list of all users in the DB, as User objects.
359
return self.get_all("login", self.login_getfields, dry=dry)
362
userdicts = self.get_all("login", self.login_getfields, dry=dry)
364
return userdicts # Query string
365
# Package into User objects
366
return [user.User(**userdict) for userdict in userdicts]
361
368
def user_authenticate(self, login, password, dry=False):
362
369
"""Performs a password authentication on a user. Returns True if