Univention Bugzilla – Bug 34070
Extended Attributes in syntax.d are not handled the same as in syntax.py
Last modified: 2017-01-23 16:39:00 CET
Created attachment 5782 [details] Same syntax - different widgets Syntax definitions in syntax.py are not handled the same as in syntax.d/FOO.py (see screenshot). Setup was like this: root@master:/usr/share/pyshared/univention/admin# grep -A8 FastPrinterList syntax.py class FastPrinterList( UDM_Objects ): udm_modules = ( 'shares/printer', ) key = 'dn' label = 'dn' simple = True use_objects = False empty_value = True root@master:/usr/share/pyshared/univention/admin# cat syntax.d/fastprinterlist.py class FastPrinterListExt( UDM_Objects ): udm_modules = ( 'shares/printer', ) key = 'dn' label = 'dn' simple = True use_objects = False empty_value = True root@master:/usr/share/pyshared/univention/admin# udm settings/extended_attribute list DN: cn=TEST-INT,cn=custom attributes,cn=univention,dc=nstx,dc=local ARG: None objectClass: univentionFreeAttributes groupPosition: None module: groups/group overwritePosition: None hook: None overwriteTab: 0 shortDescription: TEST-syntax.py groupName: TEST version: 2 valueRequired: 0 CLIName: TEST-INT fullWidth: 0 longDescription: None doNotSearch: 0 tabName: TEST syntax: FastPrinterList tabAdvanced: 0 name: TEST-INT default: None mayChange: 1 multivalue: 0 ldapMapping: univentionFreeAttribute1 deleteObjectClass: 0 notEditable: 0 tabPosition: None disableUDMWeb: 0 DN: cn=TEST-EXT,cn=custom attributes,cn=univention,dc=nstx,dc=local ARG: None objectClass: univentionFreeAttributes groupPosition: None module: groups/group overwritePosition: None hook: None overwriteTab: 0 shortDescription: TEST-syntax.d groupName: TEST version: 2 valueRequired: 0 CLIName: TEST-EXT fullWidth: 0 longDescription: None doNotSearch: 0 tabName: TEST syntax: FreePrinterListExt tabAdvanced: 0 name: TEST-EXT default: None mayChange: 1 multivalue: 0 ldapMapping: univentionFreeAttribute1 deleteObjectClass: 0 notEditable: 0 tabPosition: None disableUDMWeb: 0 root@master:/usr/share/pyshared/univention/admin# Traceback of Bug 32096 was also triggered. Add a "lookup_filter" method to shares/printer.py: -- printer.py.BACKUP 2014-02-07 11:26:37.000000000 +0100 +++ printer.py.printerassignment 2014-02-07 11:34:40.000000000 +0100 @@ -365,6 +365,14 @@ printergroup_object['groupMember'].remove(self.info['name']) printergroup_object.modify() +def lookup_filter(filter_s=None, lo=None): + lookup_filter_obj = univention.admin.filter.conjunction('&', [ + univention.admin.filter.expression('objectClass', 'univentionPrinter'), + ]) + lookup_filter_obj.append_unmapped_filter_string(filter_s, univention.admin.mapping.mapRewrite, mapping) + return lookup_filter_obj + + def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0): filter=univention.admin.filter.conjunction('&', [
A syntax inheriting "IStates" does not work but inheriting from "select" does work.
Is this still unfixed in UCS 4.1? My guess is that the reload(syntax) causes that issubcluss/isinstance(foo, UDM_Objects) causes to return False as the original instance doesn't exists anymore.
from univention.management.console.modules.udm import * set_bind_function(lambda lo: lo.bind('uid=Administrator,cn=users,dc=school,dc=local', 'univention')) group = UDM_Module('groups/group') props = group.properties a, b = [x for x in props if x['id'].startswith('TEST')] import univention print univention.admin.handlers.groups.group.property_descriptions['TEST-EXT'].syntax.name 'string'
At first I thought this is a duplicate of Bug #43094. Then I saw it wasn't and debugged it. And this is what I found: (In reply to Sönke Schwardt-Krummrich from comment #0) > root@master:/usr/share/pyshared/univention/admin# cat > syntax.d/fastprinterlist.py > class FastPrinterListExt( UDM_Objects ): … > DN: cn=TEST-EXT,cn=custom attributes,cn=univention,dc=nstx,dc=local … > syntax: FreePrinterListExt … → "FreePrinterListExt" != "FastPrinterListExt" INVALID!
Oh well, but if I fix your typo then I can reproduce it with the old package. It is fixed with the new package. *** This bug has been marked as a duplicate of bug 43094 ***
<http://errata.software-univention.de/ucs/4.1/376.html>