from osv import fields,osv,orm
from tools.translate import _
from tools import ustr
+from tools.safe_eval import safe_eval
#class ir_model_fields(osv.osv):
# _inherit = 'ir.model.fields'
arch = '<?xml version="1.0" encoding="utf-8"?>\n'
if view_type=='graph':
orientation_eval = {'horz':'horizontal','vert' :'vertical'}
- orientation = eval(report.view_graph_orientation,orientation_eval)
+ orientation = safe_eval(report.view_graph_orientation,orientation_eval)
arch +='<graph string="%s" type="%s" orientation="%s">' % (report.name, report.view_graph_type, orientation)
i = 0
for val in ('x','y'):
import netsvc
from osv import fields,osv
from tools.translate import _
+from tools.safe_eval import safe_eval
class delivery_carrier(osv.osv):
_name = "delivery.carrier"
for line in grid.line_ids:
price_dict = {'price': total, 'volume':volume, 'weight': weight, 'wv':volume*weight}
- test = eval(line.type+line.operator+str(line.max_value), price_dict)
+ test = safe_eval(line.type+line.operator+str(line.max_value), price_dict)
if test:
if line.price_type=='variable':
price = line.list_price * price_dict[line.variable_factor]
##############################################################################
import base64
-
-from osv import osv, fields
-from osv.orm import except_orm
-import urlparse
-
import os
-
-import pooler
-from content_index import content_index
-import netsvc
+import urlparse
import StringIO
-
import random
import string
from psycopg2 import Binary
-from tools import config
+
import tools
from tools.translate import _
+from tools import config
+from tools.safe_eval import safe_eval as eval
+
+from osv import osv, fields
+from osv.orm import except_orm
+
+import pooler
+import netsvc
+
+from content_index import content_index
def random_name():
random.seed()
if self.object and self.root and (self.object.type=='ressource'):
ids += fobj.search(self.cr, self.uid, where+[ ('parent_id','=',False) ])
res = fobj.browse(self.cr, self.uid, ids, context=self.context)
- return map(lambda x: node_class(self.cr, self.uid, self.path+'/'+eval('x.'+fobj._rec_name), x, False, context=self.context, type='file', root=False), res) + res2
+ return map(lambda x: node_class(self.cr, self.uid, self.path+'/'+eval('x.'+fobj._rec_name, {'x' : x}), x, False, context=self.context, type='file', root=False), res) + res2
def get_translation(self,value,lang):
result = value
file_ids=fobj.search(self.cr,self.uid,vargs)
res = fobj.browse(self.cr, self.uid, file_ids, context=self.context)
- result +=map(lambda x: node_class(self.cr, self.uid, self.path+'/'+eval('x.'+fobj._rec_name), x, False, context=self.context, type='file', root=self.root), res)
+ result +=map(lambda x: node_class(self.cr, self.uid, self.path+'/'+eval('x.'+fobj._rec_name, {'x' : x}), x, False, context=self.context, type='file', root=self.root), res)
if self.type=='collection' and self.object.type=="ressource":
where = self.object.domain and eval(self.object.domain, {'active_id':self.root, 'uid':self.uid}) or []
pool = pooler.get_pool(self.cr.dbname)
res = obj.browse(self.cr, self.uid, ids,self.context)
for r in res:
if len(obj.fields_get(self.cr, self.uid, [_dirname_field])):
- r.name = eval('r.'+_dirname_field)
+ r.name = eval('r.'+_dirname_field, {'r' : r})
else:
r.name = False
if not r.name: