Bug 39146 - syntax.py replaces locale settings on import
syntax.py replaces locale settings on import
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UCS 4.0
Other Linux
: P5 normal (vote)
: UCS 4.1-0-errata
Assigned To: Florian Best
Daniel Tröder
: 39867 (view as bug list)
Depends on: 39131
Blocks: 39635 38370
  Show dependency treegraph
Reported: 2015-08-11 11:34 CEST by Florian Best
Modified: 2016-04-26 11:31 CEST (History)
6 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:
best: Patch_Available+

set locale for translation of country names without setting the locale for the whole process (1.03 KB, patch)
2015-11-10 11:16 CET, Daniel Tröder
Details | Diff
patch (19.18 KB, patch)
2015-11-11 11:42 CET, Florian Best
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2015-08-11 11:34:01 CEST
3045 class Country(select):
3046 »   empty_value = True
3048 »   try:
3049 »   »   locale.setlocale(locale.LC_ALL, "")
3050 »   except locale.Error:
3051 »   »   # unsupported locale setting: a locale was not installed (probably de_DE.UTF-8)
3052 »   »   pass

→ LC_ALL of the whole process is reset when including/reloading syntaxes.

+++ This bug was initially created as a clone of Bug #39131 +++

Appliance mode: When choosing German as language on the first screen and an english location (tested with boston and new york city), several tracebacks occur and can be found in setup.log.

This prevents the configuration and installation of any univention-server-* package. The symptom is that system setup finishes within seconds, and clicking on finish does not complete system setup.

Traceback (most recent call last):
  File "/usr/lib/univention-system-setup/scripts/05_role/10role", line 37, in <module>
    from univention.management.console.modules.setup.setup_script import AptScript, main, _
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/__init__.py", line 34, in <module>
    import univention.management.console.protocol
  File "/usr/lib/pymodules/python2.7/univention/management/console/protocol/__init__.py", line 187, in <module>
    from session import *
  File "/usr/lib/pymodules/python2.7/univention/management/console/protocol/session.py", line 69, in <module>
    from ..acl import LDAP_ACLs
  File "/usr/lib/pymodules/python2.7/univention/management/console/acl.py", line 72, in <module>
    import univention.admin.modules
  File "/usr/lib/pymodules/python2.7/univention/admin/modules.py", line 44, in <module>
    import univention.admin.syntax
  File "/usr/lib/pymodules/python2.7/univention/admin/syntax.py", line 3043, in <module>
    class Country(select):
  File "/usr/lib/pymodules/python2.7/univention/admin/syntax.py", line 3164, in Country
    locale.setlocale(locale.LC_ALL, "")
  File "/usr/lib/python2.7/locale.py", line 547, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
Comment 1 Daniel Tröder univentionstaff 2015-11-10 11:16:54 CET
Created attachment 7271 [details]
set locale for translation of country names without setting the locale for the whole process
Comment 2 Florian Best univentionstaff 2015-11-10 18:43:10 CET
*** Bug 39867 has been marked as a duplicate of this bug. ***
Comment 3 Florian Best univentionstaff 2015-11-11 11:42:57 CET
Created attachment 7281 [details]
Comment 4 Florian Best univentionstaff 2015-11-11 11:43:36 CET
Attached a patch which updates the syntax choices dynamically to also allow runtime change of language.
Comment 5 Florian Best univentionstaff 2015-11-17 22:50:47 CET
r65683 | YMAL Bug #39675 Bug #39146

univention-directory-manager-modules (11.0.2-6):
r65682 | Bug #39146: Fix removing of locale by Country syntax class
Comment 6 Daniel Tröder univentionstaff 2015-11-18 09:55:03 CET
OK: code
OK: YAML (small wording fix r65684)
Comment 7 Daniel Tröder univentionstaff 2015-11-23 15:40:14 CET
PS: Manual tests of the translations in the web interface were done during QA, too.
Comment 8 Janek Walkenhorst univentionstaff 2015-12-09 16:46:02 CET