On attrify également lorsque la valeur est appelé avec .get(...)
This commit is contained in:
parent
db32b1d65a
commit
0c0338719c
2 changed files with 8 additions and 2 deletions
|
@ -102,10 +102,16 @@ class AttrsDict(dict) :
|
|||
values = super(AttrsDict, self).__getitem__(attr)
|
||||
if not isinstance(values, list):
|
||||
values = [ values ]
|
||||
values = [ attrify(unicode(val, 'utf-8'), attr, self._ldif, self._conn, self._check_ctxt) for val in values]
|
||||
values = [ attrify(unicode(val, 'utf-8'), attr, self._ldif, self._conn, self._check_ctxt) for val in values if not isinstance(val, Attr)]
|
||||
self[attr] = values
|
||||
return values
|
||||
|
||||
def get(self, value, default_value):
|
||||
try:
|
||||
return self[value]
|
||||
except KeyError:
|
||||
return default_value
|
||||
|
||||
class Attr(object):
|
||||
"""Objet représentant un attribut.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue