Bug 48494 - Allow override of widget<->syntax-class mapping is broken
Allow override of widget<->syntax-class mapping is broken
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Domain management (Generic)
UCS 4.2
Other Linux
: P5 normal (vote)
: UCS 4.3-3-errata
Assigned To: Jürn Brodersen
Florian Best
:
Depends on: 38743 39041
Blocks:
  Show dependency treegraph
 
Reported: 2019-01-18 15:49 CET by Jürn Brodersen
Modified: 2019-02-20 14:52 CET (History)
3 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 7: Crash: Bug causes crash or data loss
Who will be affected by this bug?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 4: A User would return the product
User Pain: 0.160
Enterprise Customer affected?: Yes
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:
best: Patch_Available+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jürn Brodersen univentionstaff 2019-01-18 15:49:51 CET
+++ This bug was initially created as a clone of Bug #39041 +++

This is currently broken because function "__repr__" of class "_UCRWidget" in syntax.py is recursive.

'''
return '<Widget(%s, syntax=%s, default=%r)>' % (self._name, syntax, self._default_value)
'''

self._name is a method of _UCRWidget, python tries to print that as "<bound method _UCRWidget.bar of _UCRWidget>" which means __repr__ is called recursively in this case

Afaik this is needed for in8
Comment 2 Florian Best univentionstaff 2019-02-06 12:17:32 CET
patch:
-»   »   return '<Widget(%s, syntax=%s, default=%r)>' % (self._name, syntax, self._default_value)
+»   »   return '<Widget(%s, syntax=%s, default=%r)>' % (self._name.__name__ if callable(self._name) else self._name, syntax, self._default_value)
Comment 3 Jürn Brodersen univentionstaff 2019-02-11 11:18:34 CET
[4.3-3 f8e59deb42] Bug #48494: test UCRWidgets
[4.3-3 12284d44e7] Bug #48494: fix UCRWidgets
[4.3-3 ec385e9e15] Bug #48494: yaml
[4.3-3 ec08ab9d9d] Bug #48494: yaml version

Package: univention-management-console-module-udm
Version: 8.0.5-30A~4.3.0.201902111113
Branch: ucs_4.3-0
Scope: errata4.3-3

[4.4-0 04922531ff] Bug #48494: test UCRWidgets
[4.4-0 512a179914] Bug #48494: fix UCRWidgets

Package: univention-management-console-module-udm
Version: 9.0.1-4A~4.4.0.201902111116
Branch: ucs_4.4-0
Comment 4 Florian Best univentionstaff 2019-02-14 19:55:33 CET
OK: reproduced
ucr set directory/manager/web/widget/foo/{syntax=Foo,widget=CheckBox,default=1}

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/univention/management/console/protocol/modserver.py", line 101, in _load_module
    self.__module = __import__(file_, [], [], modname)
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/__init__.py", line 71, in <module>
    from .udm_ldap import (
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line 58, in <module>
    from univention.management.console.modules.udm.syntax import widget, default_value
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/syntax.py", line 145, in <module>
    __widgets = _UCRWidget.load()
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/syntax.py", line 140, in load
    MODULE.info('Added widget definition: %r' % (widgets[-1],))
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/syntax.py", line 90, in __repr__
    return '<Widget(%s, syntax=%s, default=%r)>' % (self._name, syntax, self._default_value)
…
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/syntax.py", line 90, in __repr__
    return '<Widget(%s, syntax=%s, default=%r)>' % (self._name, syntax, self._default_value)
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/syntax.py", line 87, in __repr__
    syntax = ','.join(getattr(x, 'name', str(x)) for x in self._syntax_classes)
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/syntax.py", line 87, in <genexpr>
    syntax = ','.join(getattr(x, 'name', str(x)) for x in self._syntax_classes)
RuntimeError: maximum recursion depth exceeded while calling a Python object

OK: problem fixed
OK: code review
~OK: I improved the YAML description
OK: merge to UCS 4.4
Comment 5 Arvid Requate univentionstaff 2019-02-20 14:52:13 CET
<http://errata.software-univention.de/ucs/4.3/430.html>