Univention Bugzilla – Bug 32765
Maybe broken extended attributes handling for modules without layout
Last modified: 2020-06-22 16:53:35 CEST
Created attachment 5477 [details] This look more right, but please re-check; UNTESTED r27969 changed the indention of univention/admin/modules.py to put some EA code unter a conditional: if hasattr( module, 'layout' ): This also included the call to module.extended_udm_attributes.extend([univention.admin.extended_attribute( pname, attrs.get('univentionUDMPropertyObjectClass', [])[0], attrs['univentionUDMPropertyLdapMapping'][0], deleteObjectClass, propertySyntaxString, propertyHook )]) Since this call is AFAIK not related to the layout, but is required for proper working of EAs including hooks, it looks wrong and should be checked (search for "extended_udm_attributes"in "univention/admin/handlers/__init__.py"). Currently there a 4 modules which don't declare a layout: $ grep -L ^layout */[^_]*.py computers/computer.py nagios/nagios.py settings/settings.py shares/print.py The simplest fix would be to move the above mentioned call one indention level to the left. The attached patch does more: 1. move the call before the layout attribute processing. 2. Use "continue" to skip the layout processing. 3. Factor out the "layoutDisabled" checking to also skip the rest of the loop 4. Introduce a ldap_true() function to factor out the checking for "1"|"TRUE" 5. Introduce a ldap_int() function to factor out the integer parsing 6. Fix several white space issues and break some very long lines for easier reading.