Univention Bugzilla – Bug 23765
Überschreiben des Attributes default von Properties
Last modified: 2014-04-22 11:05:55 CEST
Ich habe versucht den Default für description von users/user zu ändern: ucr set directory/manager/web/modules/users/user/properties/description/default="<username>" Das funktioniert leider nicht und wird beim Initialisieren des Modules mit dem folgenden Fehler quittiert (ich habe die Debugmeldung erweitert): 22.09.11 14:23:58.119 ADMIN ( ERROR ) : ucr_overwrite_properties: failed to set property attribute: File "/usr/lib/pymodules/python2.6/univention/admin/__init__.py", line 81, in ucr_overwrite_properties setattr( module.property_descriptions[ prop ], attr, type( getattr( module.property_descriptions[ prop ], attr ) ) ( configRegistry[ var ] ) ) Im Modul users/user ist für description kein Default angegeben (wird dann im Objekt auf None gesetzt).
Das ist nur ein Sonderfall der schon länger problematisch ist -> 3.x
It should be possible to define a default mailHomeServer for example if the user was created via AD: directory/manager/web/modules/users/user/properties/mailHomeServer/default=master.test.local
Fixed in univention-directory-manager-modules 9.0.75-20.1178.201404032359 YAML updated. Problem was: 1. default is an instancemethod, the internal name of "default" is "base_default" 2. None caused a type cast error -> type(None)(new_value)
The new code is the following: 87 » » » » old_prop_val = getattr( prop, attr ) 88 » » » » if old_prop_val is None: 89 » » » » » # if the attribute was None the type cast 90 » » » » » # will fail. best bet is str as type 91 » » » » » old_prop_val = '' 92 » » » » prop_val_type = type( old_prop_val ) 94 » » » » if hasattr( prop, attr ): getattr() in line 87 can here fail with an AttributeError. In line 94 you are using hasattr() which is then always true.
Fixed in univention-directory-manager-modules 9.0.75-21.1179.201404071110
OK, the overwrite works. (The users/user description can not be overwritten somehow (neither in UMC nor on CLI), it is always the username-default used.) YAML: OK
http://errata.univention.de/ucs/3.2/97.html