Univention Bugzilla – Bug 52226
Traceback while activating E-Mail for workgroup and changing workgroup name at the same time
Last modified: 2023-06-23 13:39:48 CEST
Steps: - create a new workgroup without E-Mail address, save - edit the workgroup, activate the E-Mail address (do not save yet) and afterwards change the group name - try to save Traceback: Interner Server-Fehler in "schoolgroups/put (workgroup-admin)". Request: schoolgroups/put (workgroup-admin) Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/univention/management/console/base.py", line 359, in __error_handling six.reraise(etype, exc, etraceback) File "/usr/lib/python2.7/dist-packages/univention/management/console/base.py", line 262, in execute function.__func__(self, request, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/univention/management/console/modules/decorators.py", line 181, in _response return function(self, request) File "/usr/lib/pymodules/python2.7/ucsschool/lib/school_umc_ldap_connection.py", line 140, in wrapper_func return func(*args, **kwargs) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/schoolgroups/__init__.py", line 326, in put success = group_from_ldap.modify(ldap_machine_write) File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/base.py", line 567, in modify success = self.modify_without_hooks(lo, validate, move_if_necessary) File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/group.py", line 246, in modify_without_hooks success = super(SchoolClass, self).modify_without_hooks(lo, validate, move_if_necessary) File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/base.py", line 584, in modify_without_hooks raise ValidationError(self.errors.copy()) ValidationError: {'email': ['Keine g\xc3\xbcltige E-Mail-Adresse']}
OK, this is not related to the change of the _description_ (one can't change the name). The root cause of the traceback is the same as in Bug #52225 - only that in this case the UDM exception isn't catched.
True, for modifications catching the ValidationError was overlooked. Luckily the fix is easy: try: success = group_from_ldap.modify(ldap_machine_write) MODULE.info("Modified, group has now members: %s" % (group_from_ldap.users,)) except udm_exceptions.base as exc: MODULE.process( 'An error occurred while modifying "%s": %s' % (group_from_umc["$dn$"], exc.message) ) raise UMC_Error(_("Failed to modify group (%s).") % exc.message) just except ValidationError as exc: [...]
(In reply to Ole Schwiegert from comment #2) > True, for modifications catching the ValidationError was overlooked. Luckily > the fix is easy: > > try: > success = group_from_ldap.modify(ldap_machine_write) > MODULE.info("Modified, group has now members: %s" % > (group_from_ldap.users,)) > except udm_exceptions.base as exc: > MODULE.process( > 'An error occurred while modifying "%s": %s' % > (group_from_umc["$dn$"], exc.message) > ) > raise UMC_Error(_("Failed to modify group (%s).") % exc.message) > > just except ValidationError as exc: > [...] Can you provide fixes as patch? This looks very much like a typo/copy paste error: `group_from_umc["$dn$"]`