Bug 35181 - Traceback if class has been specified for staff import
Traceback if class has been specified for staff import
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: UMC - CSV Import
UCS@school 3.2 R2
Other Linux
: P5 normal (vote)
: UCS@school 3.2 R2 Errata
Assigned To: Dirk Wiesenthal
Florian Best
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-06-24 09:41 CEST by Sönke Schwardt-Krummrich
Modified: 2014-08-27 17:01 CEST (History)
4 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sönke Schwardt-Krummrich univentionstaff 2014-06-24 09:41:23 CEST
http://forum.univention.de/viewtopic.php?t=3347

During CSV import for staff users a traceback is shown if no header line has been specified or if a "class" column has been specified within the header line. The traceback happens during the CSV upload.

Die Ausführung des Kommandos schoolcsvimport/save ist fehlgeschlagen:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/__init__.py", line 204, in execute
    func( request )
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/decorators.py", line 591, in _response
    return function(self, request)
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/schoolcsvimport/__init__.py", line 140, in save_csv
    has_header = user_klass.is_header(first_line, dialect)
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/schoolcsvimport/util.py", line 139, in is_header
    found_column = cls.find_field_name_from_label(column, 0)
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/schoolcsvimport/util.py", line 153, in find_field_name_from_label
    attr = cls._attributes[name]
KeyError: 'school_class'

Looks like the code tries to set the "school_class" attribute for the staff user which is (on purpose!) not defined at the staff user object.
Comment 1 Dirk Wiesenthal univentionstaff 2014-06-25 17:08:40 CEST
Fix:
class CSVStaff(CSVUser, Staff):
	birthday = birthday_attr
+
+	@classmethod
+	def find_all_fields(cls):
+		return ['name', 'firstname', 'lastname', 'birthday', 'email', 'password']
Comment 2 Sönke Schwardt-Krummrich univentionstaff 2014-08-14 09:31:13 CEST
Ammar noticed that it is also impossible to specify a password while importing staff users. A traceback is returned. The traceback is reproducible via UMC.
Comment 3 Sönke Schwardt-Krummrich univentionstaff 2014-08-14 10:46:15 CEST
(In reply to Sönke Schwardt-Krummrich from comment #2)
> Ammar noticed that it is also impossible to specify a password while
> importing staff users. A traceback is returned. The traceback is
> reproducible via UMC.

The traceback is the same as stated above. The CSV file did not contain a "class" column.
Comment 4 Dirk Wiesenthal univentionstaff 2014-08-19 23:57:11 CEST
ucs-school-umc-csv-import 1.0.23-3
Comment 5 Florian Best univentionstaff 2014-08-21 15:08:34 CEST
Traceback doesn't occur anymore. Class field is marked as unknown. Password field is regularly detected and applied to the user.
Changelog: OK
Comment 6 Sönke Schwardt-Krummrich univentionstaff 2014-08-27 17:01:50 CEST
UCS@school 3.2 R2 v2 has been released:
http://docs.univention.de/release-notes-ucsschool-3.2R2v2-de.html

If this error occurs again, please use "Clone This Bug".