Commit eb3cfecd authored by Nicolas Delaby's avatar Nicolas Delaby

Use boolean instead of integer

parent 4aa4c4f6
...@@ -108,9 +108,7 @@ class ERP5Diff: ...@@ -108,9 +108,7 @@ class ERP5Diff:
""" """
Check whether the element has any children Check whether the element has any children
""" """
if len(element) == 0: return bool(len(element))
return False
return True
def _xupdateAppendAttributes(self, dict, path): def _xupdateAppendAttributes(self, dict, path):
""" """
...@@ -233,10 +231,10 @@ class ERP5Diff: ...@@ -233,10 +231,10 @@ class ERP5Diff:
""" """
# Make sure that they are elements. # Make sure that they are elements.
if type(element1) != type(element2) or type(element1) != etree._Element: if type(element1) != type(element2) or type(element1) != etree._Element:
return 0 return False
if element1.tag != element2.tag: if element1.tag != element2.tag:
return 0 return False
id_list = [] id_list = []
for attr_map in (element1.attrib, element2.attrib): for attr_map in (element1.attrib, element2.attrib):
...@@ -246,9 +244,9 @@ class ERP5Diff: ...@@ -246,9 +244,9 @@ class ERP5Diff:
break break
if len(id_list) == 0: if len(id_list) == 0:
return 1 return True
if len(id_list) == 1: if len(id_list) == 1:
return 0 return False
return (id_list[0] == id_list[1]) return (id_list[0] == id_list[1])
def _testAttributes(self, element1, element2, path): def _testAttributes(self, element1, element2, path):
...@@ -289,10 +287,10 @@ class ERP5Diff: ...@@ -289,10 +287,10 @@ class ERP5Diff:
""" """
for child in element: for child in element:
if type(child) == etree._Element: if type(child) == etree._Element:
return 0 return False
if element.text is not None: if element.text is not None:
return 0 return False
return 1 return True
def _checkIgnoreText(self, element): def _checkIgnoreText(self, element):
""" """
...@@ -301,8 +299,8 @@ class ERP5Diff: ...@@ -301,8 +299,8 @@ class ERP5Diff:
""" """
for child in element: for child in element:
if type(child) == etree._Element: if type(child) == etree._Element:
return 1 return True
return 0 return False
def _makeRelativePathList(self, element_list): def _makeRelativePathList(self, element_list):
""" """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment