new _cw_unsafe argument to Entity.set_attributes until something nicer is done (eg #344874)
--- 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