...
  View open merge request
Commits (3)
......@@ -35,6 +35,7 @@ class TestServer(TestCase):
return [
(join('data', 'test_with_png_dataurl.html'), "html", "pdf", "application/pdf"),
(join('data', 'test_with_script.html'), "html", "pdf", "application/pdf"),
(join('data', 'test_with_script.html'), "htm", "pdf", "application/pdf"),
]
def testConvertHtmltoPdf(self):
......
......@@ -33,12 +33,12 @@ class IManager(Interface):
"""Provides public method to communicate with Cloudooo clients
"""
def convertFile(content, source_mimetype, destination_mimetype, **kw):
def convertFile(content, source_format, destination_format, **kw):
"""Returns the converted file in the given format.
content : binary data to convert
source_mimetype : mimetype of given content
destination_mimetype : expected output conversion mimetype
source_format : input format (extension without '.')
destination_format : output conversion format (extension without '.')
**kw holds specific parameters for the conversion
"""
......@@ -59,17 +59,17 @@ class IManager(Interface):
**kw holds specific parameters for the conversion
"""
def getFileMetadataItemList(content, source_mimetype):
def getFileMetadataItemList(content, source_format):
"""Returns a list key, value pairs representing the
metadata values for the document. The structure of this
list is "unpredictable" and follows the convention of each file.
content : binary data where to reads metadata
source_mimetype : mimetype of given content
source_format : input format (extension without '.')
"""
def convertFileAndGetMetadataItemList(content, source_mimetype,
destination_mimetype, **kw):
def convertFileAndGetMetadataItemList(content, source_format,
destination_format, **kw):
"""returns a converted version of provided content plus a
dictionary of extracted metadata.
signature of method is same as convertFile
......@@ -78,12 +78,12 @@ class IManager(Interface):
'metadata' entries.
"""
def updateFileMetadata(content, source_mimetype, metadata_dict):
def updateFileMetadata(content, source_format, metadata_dict):
"""Updates the content with provided metadata and
return the new file.
content : binary data to convert
source_mimetype : mimetype of given content
source_format : input format (extension without '.')
metadata_dict : Metadatas to include in content
"""
......
......@@ -123,8 +123,8 @@ class Manager(object):
# use the conversion_kw in a possible interoperable way between all
# "html to pdf" handlers.
if (conversion_kw and
source_format in ("html", "text/html") and
destination_format in ("pdf", "application/pdf")):
source_format in ("htm", "html") and
destination_format == "pdf"):
handler_class = WkhtmltopdfHandler
else:
handler_class = getHandlerClass(source_format,
......