def get_student_byid(self, usr, override=0):
"""Populate RBUser object with data from user with given id in
student database.
By default will only populate RBUser attributes that have no
value (None) unless override is enabled.
Note that all students *should* be in the database, but only
raise a RBWarningError if user does not exist."""
res = self.ldap_dcu.search_s(rbconfig.ldap_dcu_students_tree,
ldap.SCOPE_SUBTREE,
'employeeNumber=%s' % usr.id)
if res:
self.set_user_dcu(usr, res[0], override)
self.set_user_dcu_student(usr, res[0], override)
else:
raise RBWarningError(
"Student id '%s' does not exist in database" % usr.id)
评论列表
文章目录