entity.py
branchstable
changeset 2877 e469f3602858
parent 2875 b7399ef8b3e0
child 2880 bfc8e1831290
child 2920 64322aa83a1d
child 2928 edfdb69df6e8
--- 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