aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/bugdir.py
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2024-01-19 03:07:54 +0100
committerMatěj Cepl <mcepl@cepl.eu>2024-01-21 21:57:15 +0100
commitb638466e6a6ada7478758cf740c89650d0f70f59 (patch)
treef34979881a12818ba46a4b74a7a7096e737e441a /libbe/bugdir.py
parentb11b63156666589ec9749fa318fe7ecd9d1f136d (diff)
downloadbugseverywhere-b638466e6a6ada7478758cf740c89650d0f70f59.tar.gz
WIP plenty of clean-ups and porting to Python 3.
Diffstat (limited to 'libbe/bugdir.py')
-rw-r--r--libbe/bugdir.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/libbe/bugdir.py b/libbe/bugdir.py
index 5738a80..9ab8d69 100644
--- a/libbe/bugdir.py
+++ b/libbe/bugdir.py
@@ -440,7 +440,7 @@ class BugDir (list, settings_object.SavedSettingsObject):
"""
if type(xml_string) == str:
xml_string = xml_string.strip().encode('unicode_escape')
- if hasattr(xml_string, 'getchildren'): # already an ElementTree Element
+ if isinstance(xml_string, ElementTree.Element):
bugdir = xml_string
else:
bugdir = ElementTree.XML(xml_string)
@@ -452,7 +452,7 @@ class BugDir (list, settings_object.SavedSettingsObject):
self.explicit_attrs = []
uuid = None
estrs = []
- for child in bugdir.getchildren():
+ for child in bugdir:
if child.tag == 'short-name':
pass
elif child.tag == 'bug':
@@ -461,18 +461,18 @@ class BugDir (list, settings_object.SavedSettingsObject):
self.append(bg, update=True)
continue
elif child.tag in tags:
- if child.text == None or len(child.text) == 0:
+ if child.text is None or len(child.text) == 0:
text = settings_object.EMPTY
elif child.tag in ['severities', 'active-status',
'inactive-status']:
entries = []
- for entry in child.getchildren():
+ for entry in child:
if entry.tag != 'entry':
raise utility.InvalidXML(
'{} child element {} must be <entry>'.format(
child.tag, entry))
key = value = None
- for kv in entry.getchildren():
+ for kv in entry:
if kv.tag == 'key':
if key is not None:
raise utility.InvalidXML(
@@ -718,7 +718,7 @@ class RevisionedBugDir (BugDir):
self.revision = revision
def changed(self):
return self.storage.changed()
-
+
if libbe.TESTING == True:
class SimpleBugDir (BugDir):
@@ -728,7 +728,7 @@ if libbe.TESTING == True:
>>> bugdir = SimpleBugDir()
>>> uuids = list(bugdir.uuids())
>>> uuids.sort()
- >>> print uuids
+ >>> print(uuids)
['a', 'b']
>>> bugdir.cleanup()
"""