# HG changeset patch # User Sylvain Thénault # Date 1250507915 -7200 # Node ID e469f36028586551ba59d3de28ef4d7c5864a669 # Parent b6993462ddb96ab4caee3d3305567bf1c6963b72 new _cw_unsafe argument to Entity.set_attributes until something nicer is done (eg #344874) diff -r b6993462ddb9 -r e469f3602858 entity.py --- a/entity.py Mon Aug 17 12:12:40 2009 +0200 +++ b/entity.py Mon Aug 17 13:18:35 2009 +0200 @@ -834,7 +834,7 @@ # raw edition utilities ################################################### - def set_attributes(self, **kwargs): + def set_attributes(self, _cw_unsafe=False, **kwargs): assert kwargs relations = [] for key in kwargs: @@ -843,8 +843,12 @@ self.update(kwargs) # and now update the database kwargs['x'] = self.eid - self.req.execute('SET %s WHERE X eid %%(x)s' % ','.join(relations), - kwargs, 'x') + if _cw_unsafe: + self.req.unsafe_execute( + 'SET %s WHERE X eid %%(x)s' % ','.join(relations), kwargs, 'x') + else: + self.req.execute('SET %s WHERE X eid %%(x)s' % ','.join(relations), + kwargs, 'x') def delete(self): assert self.has_eid(), self.eid