From 500e964ebbe6e7fa646b4bff0832beacdca8a43d Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 23 Sep 2008 12:47:45 +0200 Subject: [PATCH] get_binary_size is renamed bin_size and its behavior is reversed (False by default) bzr revid: christophe@tinyerp.com-20080923104745-m5osg61ukqtk0szi --- bin/osv/fields.py | 4 ++-- bin/osv/orm.py | 4 ++-- bin/report/report_sxw.py | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bin/osv/fields.py b/bin/osv/fields.py index 5079100f654..daee0e4e40a 100644 --- a/bin/osv/fields.py +++ b/bin/osv/fields.py @@ -223,7 +223,7 @@ class binary(_column): val = v[name] break res.setdefault(i, val) - if context.get('get_binary_size', True): + if context.get('bin_size', False): res[i] = tools.human_size(val) return res @@ -620,7 +620,7 @@ class function(_column): else: res = self._fnct(cr, obj._table, ids, name, self._arg, context) - if self._type == 'binary' and context.get('get_binary_size', True): + if self._type == 'binary' and context.get('bin_size', False): # convert the data returned by the function with the size of that data... res = dict(map(lambda (x, y): (x, tools.human_size(len(y))), res.items())) return res diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 00e2f30b35f..0c636acdd03 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1127,7 +1127,7 @@ class orm_memory(orm_template): for f in fields_to_read: if id in self.datas: r[f] = self.datas[id].get(f, False) - if r[f] and isinstance(self._columns[f], fields.binary) and context.get('get_binary_size', True): + if r[f] and isinstance(self._columns[f], fields.binary) and context.get('bin_size', False): r[f] = len(r[f]) result.append(r) if id in self.datas: @@ -1721,7 +1721,7 @@ class orm(orm_template): def convert_field(f): if f in ('create_date', 'write_date'): return "date_trunc('second', %s) as %s" % (f, f) - if isinstance(self._columns[f], fields.binary) and context.get('get_binary_size', True): + if isinstance(self._columns[f], fields.binary) and context.get('bin_size', False): return "length(%s) as %s" % (f,f) return '"%s"' % (f,) #fields_pre2 = map(lambda x: (x in ('create_date', 'write_date')) and ('date_trunc(\'second\', '+x+') as '+x) or '"'+x+'"', fields_pre) diff --git a/bin/report/report_sxw.py b/bin/report/report_sxw.py index 5b9a78c630a..a5f7ee8d7ef 100644 --- a/bin/report/report_sxw.py +++ b/bin/report/report_sxw.py @@ -566,7 +566,6 @@ class report_sxw(report_rml): if not context: context={} context = context.copy() - context['get_binary_size'] = False pool = pooler.get_pool(cr.dbname) ir_actions_report_xml_obj = pool.get('ir.actions.report.xml')