Univention Bugzilla – Bug 52683
Select syntax type from dropdown list
Last modified: 2021-10-04 13:36:41 CEST
Similar to Bug #31857 and Bug #25054 provide a list of available syntax classes selection. univention/admin/syntax.py: class Syntax(select): """ Syntax class for Extended Attributes. """ choices = [] @classmethod def update_choices(cls): mod = sys.modules[__name__] cls.choices = sorted( (sym, sym) for sym, obj in ((sym, getattr(mod, sym)) for sym in dir(mod)) if isinstance(obj, type) and issubclass(obj, ISyntax) ) __register_choice_update_function(Syntax.update_choices) univention/admin/handlers/settings/extended_attribute.py 'syntax': univention.admin.property( ... syntax=univention.admin.syntax.Syntax, UCS Technical training 2021-01-21/22
See https://git.knut.univention.de/univention/ucs/-/tree/phahn/udm-ea
[4.4-8] ba81e362dc Bug #52683 UDM: Convert Language syntax to select .../univention-directory-manager-modules/modules/univention/admin/syntax.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) [4.4-8] ed951f3c13 Bug #52683 UDM: Add syntax to select for EA management/univention-directory-manager-modules/debian/changelog | 6 ++++++ .../modules/univention/admin/handlers/settings/extended_attribute.py | 2 +- .../modules/univention/admin/syntax.py | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) [4.4-8] 916dda4415 Bug #52683 UDM syntax: sort import statements .../modules/univention/admin/syntax.py | 33 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 16 deletions(-) Package: univention-directory-manager-modules Version: 14.0.20-19A~4.4.0.202109251745 Branch: ucs_4.4-0 Scope: errata4.4-8 [4.4-8] f06bb46853 Bug #52683: univention-directory-manager-modules 14.0.20-19A~4.4.0.202109251745 doc/errata/staging/univention-directory-manager-modules.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+)
RFC: the same for settings/extended_attribute:hook ? REOPEN: We should not by default pick the first one in UMC: diff --git management/univention-directory-manager-modules/modules/univention/admin/syntax.py management/univention-directory-manager-modules/modules/univention/admin/syntax.py index 5af5038086..6e32d25898 100644 --- management/univention-directory-manager-modules/modules/univention/admin/syntax.py +++ management/univention-directory-manager-modules/modules/univention/admin/syntax.py @@ -5295,6 +5300,8 @@ class UDM_Syntax(combobox): """ choices = [] # type: List[Tuple[str, str]] + empty_value = True + @classmethod def update_choices(cls): mod = sys.modules[__name__]
(In reply to Florian Best from comment #3) > RFC: the same for settings/extended_attribute:hook ? 1. We could do this, but "hook"s are used even less. 2. The API for hooks is also very open and getting all valid hooks from univention.admin.hook.__dict__ is tricky: "hooks" are loaded dynamically by univention.admin.modules.update() only *after* the syntax classes are updated: 95 »···univention.admin.syntax.import_syntax_files() 96 »···univention.admin.hook.iunivention/admin/modules.pymport_hook_files() Changing the order might either break some hooks or some syntax classes. Because of these 2 reasons I don't want to do this now. > REOPEN: We should not by default pick the first one in UMC: ... > management/univention-directory-manager-modules/modules/univention/admin/ > syntax.py > + empty_value = True Already fixed by 5f892f35b71 Package: univention-directory-manager-modules Version: 14.0.20-21A~4.4.0.202109271552 Branch: ucs_4.4-0 Scope: errata4.4-8
[phahn/31857-udm-ea2] 2a1fe4eddf fix[udm] Dynamic module loading management/univention-directory-manager-modules/debian/changelog | 6 ++++++ management/univention-directory-manager-modules/modules/univention/admin/modules.py | 7 ++----- 2 files changed, 8 insertions(+), 5 deletions(-) [phahn/31857-udm-ea2] 7f5ddbd4d3 Bug #50648 UDM modules: replace os.path.walk() .../modules/univention/admin/modules.py | 33 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 16 deletions(-) [phahn/31857-udm-ea2] a46cbdb708 squash! style[udm/syntax] Make choices a list of tuple .../univention-directory-manager-modules/modules/univention/admin/syntax.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) [phahn/31857-udm-ea2] 7526263bcf squash! Bug #52683 UDM: Convert Language syntax to select management/univention-directory-manager-modules/modules/univention/admin/syntax.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) Package: univention-directory-manager-modules Version: 14.0.20-22A~4.4.0.202109291137 Branch: ucs_4.4-0 Scope: errata4.4-8 [phahn/31857-udm-ea2] e39bb7d0ef Bug #52683: univention-directory-manager-modules 14.0.20-22A~4.4.0.202109291137 doc/errata/staging/univention-directory-manager-modules.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
OK: languageCode OK: UDM_Syntax OK: modules.update() ~OK: YAML (does not mention languageCode, missing dots, no sentences)
<https://errata.software-univention.de/#/?erratum=4.4x1058>