server/sources/extlite.py
branchtls-sprint
changeset 983 cf1caf460081
parent 257 4c7d3af7e94d
child 1263 01152fffd593
equal deleted inserted replaced
982:ba5257deec7d 983:cf1caf460081
   201         
   201         
   202     def add_entity(self, session, entity):
   202     def add_entity(self, session, entity):
   203         """add a new entity to the source"""
   203         """add a new entity to the source"""
   204         raise NotImplementedError()
   204         raise NotImplementedError()
   205 
   205 
   206     def local_update_entity(self, session, entity):
   206     def local_update_entity(self, session, entity, attrs=None):
   207         """update an entity in the source
   207         """update an entity in the source
   208 
   208 
   209         This is not provided as update_entity implementation since usually
   209         This is not provided as update_entity implementation since usually
   210         source don't want to simply do this, so let raise NotImplementedError
   210         source don't want to simply do this, so let raise NotImplementedError
   211         and the source implementor may use this method if necessary
   211         and the source implementor may use this method if necessary
   212         """
   212         """
   213         cu = session.pool[self.uri]
   213         cu = session.pool[self.uri]
   214         attrs = self.sqladapter.preprocess_entity(entity)
   214         if attrs is None:
       
   215             attrs = self.sqladapter.preprocess_entity(entity)
   215         sql = self.sqladapter.sqlgen.update(str(entity.e_schema), attrs, ['eid'])
   216         sql = self.sqladapter.sqlgen.update(str(entity.e_schema), attrs, ['eid'])
   216         cu.execute(sql, attrs)
   217         cu.execute(sql, attrs)
   217         
   218         
   218     def update_entity(self, session, entity):
   219     def update_entity(self, session, entity):
   219         """update an entity in the source"""
   220         """update an entity in the source"""