summaryrefslogtreecommitdiffstats
path: root/docs/release/scripts/minimaws/lib/lxparse.py
diff options
context:
space:
mode:
Diffstat (limited to 'docs/release/scripts/minimaws/lib/lxparse.py')
-rw-r--r--docs/release/scripts/minimaws/lib/lxparse.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/docs/release/scripts/minimaws/lib/lxparse.py b/docs/release/scripts/minimaws/lib/lxparse.py
index 46737ef438a..e773669080d 100644
--- a/docs/release/scripts/minimaws/lib/lxparse.py
+++ b/docs/release/scripts/minimaws/lib/lxparse.py
@@ -352,6 +352,7 @@ class SoftwareHandler(ElementHandler):
'description': TextAccumulator,
'year': TextAccumulator,
'publisher': TextAccumulator,
+ 'notes': TextAccumulator,
'part': SoftwarePartHandler }
def __init__(self, parent, **kwargs):
@@ -389,9 +390,15 @@ class SoftwareHandler(ElementHandler):
self.id = self.dbcurs.add_software(self.softwarelist, self.shortname, self.supported, self.description, self.year, self.publisher)
if self.cloneof is not None:
self.dbcurs.add_softwarecloneof(self.id, self.cloneof)
+ elif name == 'notes':
+ self.dbcurs.add_softwarenotes(self.id, handler.text)
class SoftwareListHandler(ElementHandler):
+ CHILD_HANDLERS = {
+ 'notes': TextAccumulator,
+ 'software': SoftwareHandler }
+
def __init__(self, dbconn, **kwargs):
super(SoftwareListHandler, self).__init__(parent=None, **kwargs)
self.dbconn = dbconn
@@ -419,15 +426,20 @@ class SoftwareListHandler(ElementHandler):
self.dbconn.commit()
def startChildElement(self, name, attrs):
- if name != 'software':
+ if name in self.CHILD_HANDLERS:
+ self.setChildHandler(name, attrs, self.CHILD_HANDLERS[name](self))
+ else:
raise xml.sax.SAXParseException(
- msg=('Expected "software" element but found "%s"' % (name, )),
+ msg=('Found unexpected element "%s"' % (name, )),
exception=None,
locator=self.locator)
- self.setChildHandler(name, attrs, SoftwareHandler(self))
def endChildHandler(self, name, handler):
- if name == 'software':
+ if name == 'notes':
+ dbcurs = self.dbconn.cursor()
+ dbcurs.add_softwarelistnotes(self.id, handler.text)
+ dbcurs.close()
+ elif name == 'software':
if self.entries >= 1023:
self.dbconn.commit()
self.entries = 0