def verify_users(self): """ Return a dict whose keys will be a user's T number and whose values will be the dictionary of LDAP values returned from an LDAP lookup of the user. This is called after the field has been cleaned and a list of valid-format T numbers has been generated, and will raise a validation error if any T number does not map to a valid user. """ # Get information on each user, and raise an error if a T number # returns no information on a user users = {} if self._t_numbers: ldap_conn = LDAPConnection() for t_number in self._t_numbers: info = ldap_conn.get_info_from_tnumber(t_number) if info: users[t_number] = info else: raise forms.ValidationError( _("no user could be found with the T number %(tnumber)s" ) % {'tnumber': t_number}) return users
def verify_users(self): """ Return a dict whose keys will be a user's T number and whose values will be the dictionary of LDAP values returned from an LDAP lookup of the user. This is called after the field has been cleaned and a list of valid-format T numbers has been generated, and will raise a validation error if any T number does not map to a valid user. """ # Get information on each user, and raise an error if a T number # returns no information on a user users = {} if self._t_numbers: ldap_conn = LDAPConnection() for t_number in self._t_numbers: info = ldap_conn.get_info_from_tnumber(t_number) if info: users[t_number] = info else: raise forms.ValidationError(_("no user could be found with the T number %(tnumber)s") % { 'tnumber': t_number }) return users