Reviewers: ,


Please review this at http://codereview.tryton.org/203001/

Affected files:
  M trytond/ir/action.py


Index: trytond/ir/action.py
===================================================================
--- a/trytond/ir/action.py
+++ b/trytond/ir/action.py
@@ -425,6 +425,12 @@

     def get_style_content(self, ids, name):
         res = {}
+        converter = buffer
+        default = False
+ format_ = Transaction().context.pop('%s.%s' % (self._name, name), '')
+        if format_ == 'size':
+            converter = len
+            default = 0
         for report in self.browse(ids):
             try:
                 with file_open( report.style.replace('/', os.sep),
@@ -432,7 +438,7 @@
                     data = fp.read()
             except Exception:
                 data = False
-            res[report.id] = data
+            res[report.id] = converter(data) if data else default
         return res

     def get_pyson(self, ids, name):


--
tryton-dev@googlegroups.com mailing list

Reply via email to