47 |
else: self.attr_dict = attr_dict |
else: self.attr_dict = attr_dict |
48 |
|
|
49 |
def __eq__(self, ea): |
def __eq__(self, ea): |
50 |
"""Equal if all attributes and index are equal""" |
"""Equal if all attributes are equal""" |
51 |
assert isinstance(ea, ExtendedAttributes) |
assert isinstance(ea, ExtendedAttributes) |
52 |
return ea.index == self.index and ea.attr_dict == self.attr_dict |
return ea.attr_dict == self.attr_dict |
53 |
def __ne__(self, ea): return not self.__eq__(ea) |
def __ne__(self, ea): return not self.__eq__(ea) |
54 |
|
|
55 |
def get_indexpath(self): return self.index and '/'.join(self.index) or '.' |
def get_indexpath(self): return self.index and '/'.join(self.index) or '.' |
292 |
|
|
293 |
""" |
""" |
294 |
assert isinstance(acl, self.__class__) |
assert isinstance(acl, self.__class__) |
|
if self.index != acl.index: return 0 |
|
295 |
if self.is_basic(): return acl.is_basic() |
if self.is_basic(): return acl.is_basic() |
296 |
return (self.cmp_entry_list(self.entry_list, acl.entry_list) and |
return (self.cmp_entry_list(self.entry_list, acl.entry_list) and |
297 |
self.cmp_entry_list(self.default_entry_list, |
self.cmp_entry_list(self.default_entry_list, |
301 |
|
|
302 |
def eq_verbose(self, acl): |
def eq_verbose(self, acl): |
303 |
"""Returns same as __eq__ but print explanation if not equal""" |
"""Returns same as __eq__ but print explanation if not equal""" |
|
if self.index != acl.index: |
|
|
print "index %s not equal to index %s" % (self.index, acl.index) |
|
|
return 0 |
|
304 |
if not self.cmp_entry_list(self.entry_list, acl.entry_list): |
if not self.cmp_entry_list(self.entry_list, acl.entry_list): |
305 |
print "ACL entries for %s compare differently" % (self.index,) |
print "ACL entries for %s compare differently" % (self.index,) |
306 |
return 0 |
return 0 |