entity.py
branchstable
changeset 7210 29cd85f20ccb
parent 7200 81fd6e40a6a8
child 7213 7644e68c4e9f
equal deleted inserted replaced
7205:9220ae2cacf1 7210:29cd85f20ccb
   911     def set_attributes(self, **kwargs): # XXX cw_set_attributes
   911     def set_attributes(self, **kwargs): # XXX cw_set_attributes
   912         _check_cw_unsafe(kwargs)
   912         _check_cw_unsafe(kwargs)
   913         assert kwargs
   913         assert kwargs
   914         assert self.cw_is_saved(), "should not call set_attributes while entity "\
   914         assert self.cw_is_saved(), "should not call set_attributes while entity "\
   915                "hasn't been saved yet"
   915                "hasn't been saved yet"
   916         relations = []
   916         relations = ['X %s %%(%s)s' % (key, key) for key in kwargs]
   917         for key in kwargs:
       
   918             relations.append('X %s %%(%s)s' % (key, key))
       
   919         # and now update the database
   917         # and now update the database
   920         kwargs['x'] = self.eid
   918         kwargs['x'] = self.eid
   921         self._cw.execute('SET %s WHERE X eid %%(x)s' % ','.join(relations),
   919         self._cw.execute('SET %s WHERE X eid %%(x)s' % ','.join(relations),
   922                          kwargs)
   920                          kwargs)
   923         kwargs.pop('x')
   921         kwargs.pop('x')