401
401
# Execute the query.
402
402
return self.insert(fields, "login", self.login_fields, dry=dry)
404
def get_user(self, login, dry=False):
405
"""Given a login, returns a User object containing details looked up
408
Raises a DBException if the login is not found in the DB.
410
userdict = self.get_single({"login": login}, "login",
411
self.login_fields, self.login_primary,
412
error_notfound="get_user: No user with that login name", dry=dry)
414
return userdict # Query string
415
# Package into a User object
416
return user.User(**userdict)
418
def get_users(self, dry=False):
419
"""Returns a list of all users in the DB, as User objects.
421
userdicts = self.get_all("login", self.login_fields, dry=dry)
423
return userdicts # Query string
424
# Package into User objects
425
return [user.User(**userdict) for userdict in userdicts]
427
404
def get_user_loginid(self, login, dry=False):
428
405
"""Given a login, returns the integer loginid for this user.