reports: fix some default args, import message, empty translations

bzr revid: p_christ@hol.gr-20101214162826-79ppx7qw23ag3qx0
This commit is contained in:
P. Christeas 2010-12-14 18:28:26 +02:00
parent 10c0a345e8
commit 5c6bd686ab
4 changed files with 16 additions and 10 deletions

View File

@ -164,6 +164,8 @@ class report_rml(report_int):
def translate(doc, lang):
for node in doc.xpath('//*[@t]'):
if not node.text:
continue
translation = ir_translation_obj._get_source(cr, uid, self.name2, 'xsl', lang, node.text)
if translation:
node.text = translation

View File

@ -25,8 +25,9 @@ from render import render
try:
import Image
except:
print 'WARNING; Python Imaging not installed, you can use only .JPG pictures !'
except ImportError:
import logging
logging.getLogger('init').warning('Python Imaging not installed, you can use only .JPG pictures !')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -29,12 +29,11 @@ import makohtml2html as makohtml
class rml(render.render):
def __init__(self, rml, localcontext = None, datas={}, path='.', title=None):
render.render.__init__(self, datas)
def __init__(self, rml, localcontext = None, datas=None, path='.', title=None):
render.render.__init__(self, datas, path)
self.localcontext = localcontext
self.rml = rml
self.output_type = 'pdf'
self.path = path
self.title=title
@ -42,7 +41,7 @@ class rml(render.render):
return rml2pdf.parseNode(self.rml, self.localcontext, images=self.bin_datas, path=self.path,title=self.title)
class rml2html(render.render):
def __init__(self, rml,localcontext = None, datas = {}):
def __init__(self, rml,localcontext = None, datas=None):
super(rml2html, self).__init__(datas)
self.rml = rml
self.localcontext = localcontext
@ -52,7 +51,7 @@ class rml2html(render.render):
return htmlizer.parseString(self.rml,self.localcontext)
class rml2txt(render.render):
def __init__(self, rml, localcontext= None, datas={}):
def __init__(self, rml, localcontext= None, datas=None):
super(rml2txt, self).__init__(datas)
self.rml = rml
self.localcontext = localcontext
@ -62,7 +61,7 @@ class rml2txt(render.render):
return txtizer.parseString(self.rml, self.localcontext)
class odt2odt(render.render):
def __init__(self, rml, localcontext = None, datas = {}):
def __init__(self, rml, localcontext=None, datas=None):
render.render.__init__(self, datas)
self.rml_dom = rml
self.localcontext = localcontext
@ -72,7 +71,7 @@ class odt2odt(render.render):
return odt.parseNode(self.rml_dom,self.localcontext)
class html2html(render.render):
def __init__(self, rml, localcontext = None, datas = {}):
def __init__(self, rml, localcontext=None, datas=None):
render.render.__init__(self, datas)
self.rml_dom = rml
self.localcontext = localcontext

View File

@ -942,8 +942,12 @@ class _rml_template(object):
fis.append(PageCount())
self.doc_tmpl.build(fis)
def parseNode(rml, localcontext = {},fout=None, images={}, path='.',title=None):
def parseNode(rml, localcontext=None,fout=None, images=None, path='.',title=None):
node = etree.XML(rml)
if localcontext is None:
localcontext = {}
if images is None:
images = {}
r = _rml_doc(node, localcontext, images, path, title=title)
#try to override some font mappings
try: