Closed fsundermeyer closed 9 years ago
I'll implement a fix for that.
@mschnitzer Not so fast ;-)
Your fix do catches the traceback, but the script still aborts even when working on multiple files (with some of them actually having the info element).
Whatsmore, AFAIK docmanager is supposed to create an info element when it is missing (see function create_groups()
).
Indeed, if no info
element is found, DM aborts. Problem is the create_groups() function and the else
branch. When an info
element cannot be found, DM should create one.
Insert the info
element after a title like in this example:
<article version="5.0" xml:lang="en"
xmlns:dm="urn:x-suse:ns:docmanager"
xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Example</title>
<!-- <info> should appear here -->
</article>
This is already fixed in 773b2dd60b
$ docmanager -s maintainer=fs -f xml/depl_*.xml Traceback (most recent call last): File "/usr/bin/docmanager", line 9, in
load_entry_point('docmanager==3.0.0-beta1', 'console_scripts', 'docmanager')()
File "/usr/lib/python3.4/site-packages/docmanager/init.py", line 126, in main
DocManager()
File "/usr/lib/python3.4/site-packages/docmanager/init.py", line 37, in init
action.Actions(parser.files, parser.action, parser.arguments)
File "/usr/lib/python3.4/site-packages/docmanager/action.py", line 40, in init
self.files = filehandler.Files(files)
File "/usr/lib/python3.4/site-packages/docmanager/filehandler.py", line 51, in __init
self.xml_handlers.append(xmlhandler.XmlHandler(file))
File "/usr/lib/python3.4/site-packages/docmanager/xmlhandler.py", line 42, in __init
self.create_group()
File "/usr/lib/python3.4/site-packages/docmanager/xmlhandler.py", line 56, in create_group
raise NameError("Can't find the info element in %s." %self.filename)
NameError: Can't find the info element in xml/depl_cisco.xml.
This error should be captured and should not be fatal. I suggest to proceed with the next file and to inform the user that "the following files could not be processed..." at the end.