Bug 31782 - LDAP_Search broken
LDAP_Search broken
Status: RESOLVED DUPLICATE of bug 32046
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UCS 3.1
Other Linux
: P5 normal (vote)
: ---
Assigned To: UMC maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-20 12:28 CEST by Philipp Hahn
Modified: 2018-04-13 13:28 CEST (History)
2 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 Philipp Hahn univentionstaff 2013-06-20 12:28:40 CEST
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/udm/__init__.py", line 739, in properties
    properties = module.get_properties( object_dn )
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/udm_ldap.py", line 578, in get_proper
    properties = self.properties
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/udm_ldap.py", line 155, in wrapper_fu
    ret = func( *args, **kwargs )
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/udm_ldap.py", line 638, in properties
    item.update( widget( prop.syntax, item ) )
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/syntax.py", line 143, in widget
    descr = { 'type' : widget.name( syntax, udm_property ) }
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/syntax.py", line 60, in name
    MODULE.info( 'The widget name for syntax %s is %s' % ( syntax.name, self._widget_func( syntax, udm_property ) ) 
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/syntax.py", line 73, in <lambda>
    Widget( None, ( udm_syntax.LDAP_Search, ), [], subclasses=True, widget_func = lambda syn, prop: syn.viewonly and
AttributeError: type object 'xxxxInventoryItem2Computer' has no attribute 'viewonly'


univention/management/console/modules/udm/syntax.py:73
        Widget( None, ( udm_syntax.LDAP_Search, ), [], subclasses=True, widget_func = lambda syn, prop: syn.viewonly and 'LinkList' or 'ComboBox' ),

That is because the function gets passed the *class* and not an *instance* of that class. The viewonly attribute is only set in __init__(self).

This currently only works for Prolicy references, because of the following hack in univention/management/console/modules/udm/udm_ldap.py:578
                if ldap_dn:
                        # hack reference list for policies into items
                        if self.is_policy_module():
                                # create syntax object
                                syntax = udm_syntax.LDAP_Search(
                                        filter = '(&(objectClass=univentionPolicyReference)(univentionPolicyReference=%s))' % ldap_dn,
                                        viewonly = True )
So there syntax is an *instance*.

Adding a class variable "viewonly" prevents the traceback, but stil does not work, since univention/management/console/modules/udm/syntax.py:103 onyl checks for *instances*, but not for *subclasses*:
        elif isinstance( syntax, udm_syntax.LDAP_Search ):

Since LDAP_Search with viewonly=True was the only way to generically link from one UDM object to another referenced UDM object, this functionality is now gone with all current versions of UCS-3.x, which is a huge usability regression.
Comment 1 Alexander Kläser univentionstaff 2013-07-24 17:42:32 CEST

*** This bug has been marked as a duplicate of bug 32046 ***