Bug 15556 - Fehler in LocalizedDictionary.get()
Fehler in LocalizedDictionary.get()
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UCR
UCS 2.3
Other Linux
: P5 normal (vote)
: UCS 2.3
Assigned To: Andreas Büsching
Felix Botner
:
Depends on:
Blocks: 8871 14412
  Show dependency treegraph
 
Reported: 2009-09-02 12:05 CEST by Daniel Hofmann
Modified: 2009-12-21 08:46 CET (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 Daniel Hofmann univentionstaff 2009-09-02 12:05:34 CEST
Ist für einen Schlüssel eine Übersetzung vorhanden, aber nicht die gewünschte, so gibt bspw. LocalizedDictionary.get() immer None, anstatt dem gewünschten default-Wert zurück, wenn keine vorhandene Übersetzung gewünscht ist:

/etc/univention/registry.info/variables/univention-samba.cfg:
...
[samba/debug/level]
Description[de]=Debug Level für Samba Prozesse
Type=str
Categories=service-samba
...

import univention.config_registry_info as cri
cri.set_language ('en')
c = cri.ConfigRegistryInfo ()
v = c.get_variable ('samba/debug/devel')
print v.get('description', 'no description available')
Comment 1 Daniel Hofmann univentionstaff 2009-09-02 12:12:08 CEST
Korrektur: Der Rückgabewert ist nicht immer None, aber im Allgemeinen auch nicht der gewünschte Defaultwert
Comment 2 Ingo Steuwer univentionstaff 2009-11-02 11:51:02 CET
Im UMC-UCR-Modul von 2.3 wird die Kategorie "service-samba" nicht angezeigt, obwohl sie definiert ist. Ist dieser Bug die Ursache dafür?
Comment 3 Stefan Gohmann univentionstaff 2009-11-05 08:06:05 CET
Das sollten wir prüfen. In UMC fehlt im Moment die Kategorie Samba.
Comment 4 Andreas Büsching univentionstaff 2009-11-05 14:04:36 CET
(In reply to comment #2)
> Im UMC-UCR-Modul von 2.3 wird die Kategorie "service-samba" nicht angezeigt,
> obwohl sie definiert ist. Ist dieser Bug die Ursache dafür?

Das lag daran, dass die Kategorie Definition nicht im Paket enthalten war. Das ist jetzt gefixt.
Comment 5 Andreas Büsching univentionstaff 2009-11-05 14:36:52 CET
__getitem__ wirft jetzt eine KeyError Exception, wenn der Key nicht existiert. In diesem Fall gibt get dann den default Wert zurück.

Soll hierzu ein ChangeLog Eintrag erstellt werden?
Comment 6 Andreas Büsching univentionstaff 2009-11-05 14:56:15 CET
Changelog Eintrag ist jetzt auch vorhanden.
Comment 7 Felix Botner univentionstaff 2009-11-10 09:05:45 CET
Wenn ich die Info einer UCR Variable in einer Sprache haben will, für die es keine Übersetzung gibt, bekomme ich nichts zurück (also nicht den default):

import univention.config_registry_info as cri
cri.set_language ('fr')
c = cri.ConfigRegistryInfo ()
v = c.get_variable ('samba/serverstring')
print v.get('description', 'no description available')

Sollte hier nicht der default angezeigt werden?

Wenn ich per UMC nach allen Variablen (in allen Kategorien Suche), knallt es ebenfalls:

Die Ausführung des Kommandos 'baseconfig/search' ist fehlgeschlagen:

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/univention/management/console/handlers/__init__.py", line 118, in _exec_if
    func( *args )
  File "/usr/lib/python2.4/site-packages/univention/management/console/handlers/baseconfig/_revamp.py", line 95, in _web_baseconfig_search
    if var[ 'description' ]:
  File "/usr/lib/python2.4/site-packages/univention/info_tools.py", line 98, in __getitem__
    raise KeyError( key )
KeyError: 'description'
Comment 8 Andreas Büsching univentionstaff 2009-11-17 17:43:12 CET
(In reply to comment #7)
> Wenn ich die Info einer UCR Variable in einer Sprache haben will, für die es
> keine Übersetzung gibt, bekomme ich nichts zurück (also nicht den default):
> 
> import univention.config_registry_info as cri
> cri.set_language ('fr')
> c = cri.ConfigRegistryInfo ()
> v = c.get_variable ('samba/serverstring')
> print v.get('description', 'no description available')
> 
> Sollte hier nicht der default angezeigt werden?

Ja, ist jetzt korrigiert.

> Wenn ich per UMC nach allen Variablen (in allen Kategorien Suche), knallt es
> ebenfalls:

Ist auch angepasst.
Comment 9 Felix Botner univentionstaff 2009-11-18 09:16:54 CET
get) OK

-> import univention.config_registry_info as cri
-> cri.set_language ('fr')
-> c = cri.ConfigRegistryInfo ()
-> v = c.get_variable ('version/version')
-> print v.get('description', 'no description available')

<- no description available

UMC) OK

Suche nach allen Variablen klappt

service-samba) OK

Im UMC wird die Kategorie Services for Windows angezeigt.

Changelog Eintrg) OK
Comment 10 Stefan Gohmann univentionstaff 2009-12-21 08:46:04 CET
UCS 2.3 wurde veröffentlicht. Sollte der hier beschriebene Bug mit einer neueren Version von UCS erneut auftreten, so sollte der Bug dupliziert werden: "Clone This Bug".