[attributs] assert value is not only unicode but can also be of the specified python type
This commit is contained in:
parent
0486929a5a
commit
aea8e9d974
2 changed files with 3 additions and 3 deletions
|
@ -211,7 +211,7 @@ class Attr(object):
|
||||||
"""Crée un nouvel objet représentant un attribut."""
|
"""Crée un nouvel objet représentant un attribut."""
|
||||||
self.value = None
|
self.value = None
|
||||||
self.conn = conn
|
self.conn = conn
|
||||||
assert isinstance(val, unicode)
|
assert isinstance(val, unicode) or (self.python_type and isinstance(val, self.python_type))
|
||||||
self.parent = Parent
|
self.parent = Parent
|
||||||
self.parse_value(val)
|
self.parse_value(val)
|
||||||
|
|
||||||
|
|
|
@ -1029,8 +1029,8 @@ class facture(CransLdapObject):
|
||||||
# ajoute à la liste d'articles de frais
|
# ajoute à la liste d'articles de frais
|
||||||
self._frais.append(attributs.attrify('FRAIS~~Frais de tansaction PayPal~~1~~%s' % round(s, 2), 'article', self.conn, Parent=self))
|
self._frais.append(attributs.attrify('FRAIS~~Frais de tansaction PayPal~~1~~%s' % round(s, 2), 'article', self.conn, Parent=self))
|
||||||
|
|
||||||
def __getitem__(self,attr):
|
def __getitem__(self,attr, default=None):
|
||||||
ret = super(facture, self).__getitem__(attr)
|
ret = super(facture, self).__getitem__(attr, default)
|
||||||
if attr == 'article' and self.mode == 'ro':
|
if attr == 'article' and self.mode == 'ro':
|
||||||
return ret + self._frais
|
return ret + self._frais
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue