utils.py
branch3.5
changeset 2935 e06b3eadef31
parent 2932 90ad3f31204a
child 2936 f35b64718d02
equal deleted inserted replaced
2934:cf4d39416fca 2935:e06b3eadef31
   318                                                  self.htmltag,
   318                                                  self.htmltag,
   319                                                  self.head.getvalue(),
   319                                                  self.head.getvalue(),
   320                                                  self.body.getvalue())
   320                                                  self.body.getvalue())
   321 
   321 
   322 
   322 
       
   323 def can_do_pdf_conversion(__answer=[None]):
       
   324     """pdf conversion depends on
       
   325     * pyxmltrf (python package)
       
   326     * fop 0.9x
       
   327     """
       
   328     if __answer[0] is not None:
       
   329         return __answer[0]
       
   330     try:
       
   331         import pyxmltrf
       
   332     except ImportError:
       
   333         __answer[0] = False
       
   334         return False
       
   335     from subprocess import Popen, STDOUT
       
   336     import os
       
   337     try:
       
   338         Popen(['/usr/bin/fop', '-q'],
       
   339               stdout=open(os.devnull, 'w'),
       
   340               stderr=STDOUT)
       
   341     except OSError, e:
       
   342         print e
       
   343         __answer[0] = False
       
   344         return False
       
   345     __answer[0] = True
       
   346     return True