[attributs] Fonction utile sur les AttrsList, __cmp__ ne sert à rien et plante si python_type = int
This commit is contained in:
parent
4fea59bbeb
commit
480497ce4e
1 changed files with 5 additions and 6 deletions
11
attributs.py
11
attributs.py
|
@ -152,6 +152,11 @@ class AttrsList(list):
|
||||||
super(AttrsList, self).__delitem__(index)
|
super(AttrsList, self).__delitem__(index)
|
||||||
self._commit()
|
self._commit()
|
||||||
|
|
||||||
|
def __setitem__(self, index, value):
|
||||||
|
self._start()
|
||||||
|
super(AttrsList, self).__setitem__(index, value)
|
||||||
|
self._commit()
|
||||||
|
|
||||||
def append(self, val):
|
def append(self, val):
|
||||||
self._start()
|
self._start()
|
||||||
super(AttrsList, self).append(val)
|
super(AttrsList, self).append(val)
|
||||||
|
@ -302,12 +307,6 @@ class Attr(object):
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def __cmp__(self, obj):
|
|
||||||
if isinstance(obj, Attr):
|
|
||||||
return self.value.__cmp__(obj.value)
|
|
||||||
else:
|
|
||||||
return self.value.__cmp__(obj)
|
|
||||||
|
|
||||||
def __nonzero__(self):
|
def __nonzero__(self):
|
||||||
if self.value:
|
if self.value:
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue