http://codereview.appspot.com/4717041/diff/7/relatorio/templates/opendocument.py File relatorio/templates/opendocument.py (right): http://codereview.appspot.com/4717041/diff/7/relatorio/templates/opendocument.py#newcode48 relatorio/templates/opendocument.py:48: import xml.dom.minidom Don't use minidom, use lxml http://codereview.appspot.com/4717041/diff/7/relatorio/templates/opendocument.py#newcode267 relatorio/templates/opendocument.py:267: ...
13 years, 4 months ago
(2011-07-14 10:35:40 UTC)
#1
http://codereview.appspot.com/4717041/diff/7/relatorio/templates/opendocument.py
File relatorio/templates/opendocument.py (right):
http://codereview.appspot.com/4717041/diff/7/relatorio/templates/opendocument...
relatorio/templates/opendocument.py:48: import xml.dom.minidom
Don't use minidom, use lxml
http://codereview.appspot.com/4717041/diff/7/relatorio/templates/opendocument...
relatorio/templates/opendocument.py:267: meta = file('meta.xml', 'w')
I think you can use StringIO instead of real file.
http://codereview.appspot.com/4717041/diff/7/relatorio/templates/opendocument...
relatorio/templates/opendocument.py:268: for node in
dom.getElementsByTagName('office:meta'):# visit every node <office:meta />
Fit to 80cols
http://codereview.appspot.com/4717041/diff/7/relatorio/templates/opendocument...
relatorio/templates/opendocument.py:321: # content = ('<?xml
version="1.0" encoding="UTF-8"?> \n <office:document-content
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
xmlns:math="http://www.w3.org/1998/Math/MathML"
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
xmlns:ooo="http://openoffice.org/2004/office"
xmlns:ooow="http://openoffice.org/2004/writer"
xmlns:oooc="http://openoffice.org/2004/calc"
xmlns:dom="http://www.w3.org/2001/xml-events"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:rpt="http://openoffice.org/2005/report"
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2"
xmlns:rdfa="http://docs.oasis-open.org/opendocument/meta/rdfa#"
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0"
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
office:version="1.2">' + content1 + content2 + content3 + content4 +
'</office:document-content>')
Remove comments
http://codereview.appspot.com/4717041/diff/7/relatorio/templates/opendocument...
relatorio/templates/opendocument.py:327: def _parseFODT(self, source, encoding):
I think you can merge with _parse by doing ducktyping on zipfile.ZipFile
http://codereview.appspot.com/4717041/diff/7/relatorio/templates/opendocument...
relatorio/templates/opendocument.py:366: print io
not useful
http://codereview.appspot.com/4717041/diff/7/relatorio/tests/test_odt.py
File relatorio/tests/test_odt.py (right):
http://codereview.appspot.com/4717041/diff/7/relatorio/tests/test_odt.py#newc...
relatorio/tests/test_odt.py:58: # change test.odt to test.fodt to make test for
fodt format
You could perhaps make a loop to test both format type.
http://codereview.appspot.com/4717041/diff/7/relatorio/tests/test_odt.py#newc...
relatorio/tests/test_odt.py:314: if __name__ == '__main__':
No need of that to run the tests:
python setup.py test
Issue 4717041: fodt parsing with Relatorio
Created 13 years, 4 months ago by martinleon.sebastien
Modified 13 years, 3 months ago
Reviewers: ced
Base URL:
Comments: 13