Index: umc/python/udm/udm_ldap.py =================================================================== --- umc/python/udm/udm_ldap.py (Revision 40433) +++ umc/python/udm/udm_ldap.py (Arbeitskopie) @@ -1065,32 +1065,40 @@ if issubclass( syn.__class__, udm_syntax.UDM_Objects ): syn.choices = [] + def extract_key_label(syn, dn, info): + key = label = None + if syn.key == 'dn': + key = dn + else: + try: + key = syn.key % info + except KeyError: + pass + if syn.label == 'dn': + label = dn + elif syn.label is None: + pass + else: + try: + label = syn.label % info + except KeyError: + pass + return key, label def map_choices( obj_list ): result = [] for obj in obj_list: - obj.open() - - if syn.key == 'dn': - key = obj.dn - else: - try: - key = syn.key % obj.info - except KeyError: + key, label = extract_key_label(syn, obj.dn, obj.info) + if key is None or label is None: + obj.open() + key, label = extract_key_label(syn, obj.dn, obj.info) + if key is None: # ignore the entry as the key is important for a selection, there # is no sensible fallback for the key (Bug #26994) continue - if syn.label is None: - label = udm_objects.description( obj ) - elif syn.label == 'dn': - label = obj.dn - else: - try: - label = syn.label % obj.info - except KeyError: + if label is None: # fallback to the default description as this is just what displayed # to the user (Bug #26994) label = udm_objects.description( obj ) - result.append( (key, label) ) return result Index: modules/univention/admin/handlers/shares/share.py =================================================================== --- modules/univention/admin/handlers/shares/share.py (Revision 40433) +++ modules/univention/admin/handlers/shares/share.py (Arbeitskopie) @@ -827,6 +827,10 @@ if 'univentionShareNFS' in self.oldattr['objectClass']: self.options.append( 'nfs' ) try: + # ATTENTION: syntax nfsShare wants to use + # %(printablename)s as label but we changed that because + # of lookup performance reasons. If you change printablename + # here, you probably want to change the label of the syntax, too. self['printablename'] = "%s (%s)" % (self['name'], self['host']) except: pass @@ -900,7 +904,6 @@ if not hasattr(self,"options"): self.open() if 'nfs' in self.options: - ulist=[] searchstring="*"+self['host']+":"+self['path']+"*" searchResult=self.lo.searchDn(base=self.position.getDomain(), filter='(&(objectClass=person)(automountInformation=%s))'%searchstring, scope='domain') if searchResult: Index: modules/univention/admin/de.po =================================================================== --- modules/univention/admin/de.po (Revision 40433) +++ modules/univention/admin/de.po (Arbeitskopie) @@ -221,6 +221,10 @@ msgid "cannot find fqdn of " msgstr "FQDN konnte nicht gefunden werden: " +#: syntax.py:1743 +msgid "%(name)s (%(path)s on %(host)s)" +msgstr "%(name)s (%(path)s auf %(host)s)" + #: syntax.py:109 syntax.py:162 syntax.py:298 msgid "Invalid value" msgstr "Ungültiger Wert" Index: modules/univention/admin/syntax.py =================================================================== --- modules/univention/admin/syntax.py (Revision 40433) +++ modules/univention/admin/syntax.py (Arbeitskopie) @@ -1603,9 +1603,11 @@ class GroupDN( UDM_Objects ): udm_modules = ( 'groups/group', ) + label = '%(name)s' # TODO: may be removed when UDM_Objects is able to extract from DN without initializing object class UserDN( UDM_Objects ): udm_modules = ( 'users/user', ) + label = '%(username)s' # TODO: may be removed when UDM_Objects is able to extract from DN without initializing object class HostDN( UDM_Objects ): udm_modules = ( 'computers/computer', ) @@ -1687,12 +1689,14 @@ class DNS_ForwardZone( UDM_Objects ): description=_('DNS forward zone') udm_modules = ( 'dns/forward_zone', ) + label = '%(zone)s' empty_value = True size = 'TwoThirds' class DNS_ReverseZone( UDM_Objects ): description=_('DNS reverse zone') udm_modules = ( 'dns/reverse_zone', ) + label = '%(subnet)s' empty_value = True size = 'TwoThirds' @@ -1736,6 +1740,7 @@ class WritableShare( UDM_Objects ): udm_modules = ( 'shares/share', ) udm_filter = 'writeable=1' + label = _('%(name)s (%(path)s on %(host)s)') # ldap-optimized for shares/share.description() size = 'OneAndAHalf' empty_value = True @@ -2551,7 +2556,7 @@ class nfsShare(UDM_Objects): udm_modules = ( 'shares/share', ) key = 'dn' - label = '%(printablename)s' + label = '%(name)s (%(host)s)' # ldap-optimized for '%(printablename)s' udm_filter = 'objectClass=univentionShareNFS' class nfsMounts(complex):