def __init__(self, name=None, input_extension=None, **kwargs): self.config = { 'binary_path': '', 'command_line': '', 'inputs': ('text/plain',), 'output': 'text/plain', } self.config_metadata = { 'binary_path': ( 'string', 'Binary path', 'Path of the executable on the server.'), 'command_line': ( 'string', 'Command line', '''Additional command line option. There should be at least the input file (designed by "%(input)s"). The transformation\'s result must be printed on stdout. '''), 'inputs': ( 'list', 'Inputs', 'Input(s) MIME type. Change with care.'), 'output': ( 'string', 'Output', 'Output MIME type. Change with care.'), } self.config.update(kwargs) commandtransform.__init__(self, name=name, binary=self.config['binary_path'], **kwargs) # use the full binary path self.config.update({'binary_path': self.binary}) self.input_extension = input_extension
def __init__(self, name, data, cache_dir=None): commandtransform.__init__(self, name) name = self.name() self.tmpdir, self.fullname = self.initialize_tmpdir( data, filename=name) self.cache_dir = cache_dir self.client = Client(cache_dir=cache_dir)
def __init__(self, name, data): """ Initialization: create tmp work directory and copy the document into a file""" commandtransform.__init__(self, name) name = self.name() self.tmpdir, self.fullname = self.initialize_tmpdir(data, filename=name) self.outputfile = self.fullname + ".html"
def __init__(self, context, name, data, mimetype): commandtransform.__init__(self, name) self.__name__ = name self.mimetype = mimetype self.context = context if self.mimetype == 'text/html': data = self.includeExternalCssList(data) self.data = data
def __init__(self, name, data): """ Initialization: create tmp work directory and copy the document into a file""" commandtransform.__init__(self, name, binary="wvHtml") name = self.name() if not name.endswith(".doc"): name = name + ".doc" self.tmpdir, self.fullname = self.initialize_tmpdir(data, filename=name)
def __init__(self, name, data, outmime): """ Initialization: create tmp work directory and copy the document into a file""" self.outmime=outmime commandtransform.__init__(self, name, binary=mimecmdmap[outmime]) name = self.name() if not name.endswith('.xls'): name = name + ".xls" self.tmpdir, self.fullname = self.initialize_tmpdir(data, filename=name)
def __init__(self, name, data, xsl_stylesheet_path=None, xml_doc_path=None): """Initialize document. Store stylesheet and other important data, then create a temporary directory for conversion. """ self.xsl_stylesheet = xsl_stylesheet_path or self.xsl_stylesheet_path self.xml_doc = xml_doc_path or self.xml_doc_path commandtransform.__init__(self, name) name = self.name() self.tmpdir, self.fullname = self.initialize_tmpdir(data, filename=name)
def __init__(self, name, data): """Initialize document. Append '.odt' to filename if missing and create a temporary directory for conversion. """ if not name.lower().endswith('.odt'): name = name + '.odt' commandtransform.__init__(self, name, binary='xsltproc') name = self.name() self.tmpdir, self.fullname = self.initialize_tmpdir( data, filename=name)
def __init__(self, name, data, exec_prefix=None): """ Initialization: create tmp work directory and copy the document into a file""" tika_path = 'tika' if exec_prefix is not None: tika_path = os.path.join(exec_prefix, 'tika-bin') if not os.path.exists(tika_path): tika_path = os.path.join(exec_prefix, 'tika') if not os.path.exists(tika_path): log.warn('no tika-bin or tika found in exec-prefix: %s' % tika_path) tika_path = 'tika' commandtransform.__init__(self, name, binary=tika_path) name = self.name() if not name.endswith(self.file_ext): name = name + self.file_ext self.tmpdir, self.fullname = self.initialize_tmpdir(data, filename=name)
def __init__(self): commandtransform.__init__(self, binary=self.binaryName)