server/migractions.py
changeset 4945 356662a6f06c
parent 4925 0d66fbe050c6
child 4951 7dc54e12c606
equal deleted inserted replaced
4944:65533aee8d0a 4945:356662a6f06c
   267         if self.session:
   267         if self.session:
   268             self.session.set_pool()
   268             self.session.set_pool()
   269 
   269 
   270     def rqlexecall(self, rqliter, cachekey=None, ask_confirm=True):
   270     def rqlexecall(self, rqliter, cachekey=None, ask_confirm=True):
   271         for rql, kwargs in rqliter:
   271         for rql, kwargs in rqliter:
   272             self.rqlexec(rql, kwargs, cachekey, ask_confirm)
   272             self.rqlexec(rql, kwargs, cachekey, ask_confirm=ask_confirm)
   273 
   273 
   274     @cached
   274     @cached
   275     def _create_context(self):
   275     def _create_context(self):
   276         """return a dictionary to use as migration script execution context"""
   276         """return a dictionary to use as migration script execution context"""
   277         context = super(ServerMigrationHelper, self)._create_context()
   277         context = super(ServerMigrationHelper, self)._create_context()
  1197                 return cu.fetchall()
  1197                 return cu.fetchall()
  1198             except:
  1198             except:
  1199                 # no result to fetch
  1199                 # no result to fetch
  1200                 return
  1200                 return
  1201 
  1201 
  1202     def rqlexec(self, rql, kwargs=None, cachekey=None, ask_confirm=True):
  1202     def rqlexec(self, rql, kwargs=None, cachekey=None, build_descr=True,
       
  1203                 ask_confirm=True):
  1203         """rql action"""
  1204         """rql action"""
  1204         if not isinstance(rql, (tuple, list)):
  1205         if not isinstance(rql, (tuple, list)):
  1205             rql = ( (rql, kwargs), )
  1206             rql = ( (rql, kwargs), )
  1206         res = None
  1207         res = None
  1207         execute = self._cw.execute
  1208         execute = self._cw.execute
  1210                 msg = '%s (%s)' % (rql, kwargs)
  1211                 msg = '%s (%s)' % (rql, kwargs)
  1211             else:
  1212             else:
  1212                 msg = rql
  1213                 msg = rql
  1213             if not ask_confirm or self.confirm('Execute rql: %s ?' % msg):
  1214             if not ask_confirm or self.confirm('Execute rql: %s ?' % msg):
  1214                 try:
  1215                 try:
  1215                     res = execute(rql, kwargs, cachekey)
  1216                     res = execute(rql, kwargs, cachekey, build_descr=build_descr)
  1216                 except Exception, ex:
  1217                 except Exception, ex:
  1217                     if self.confirm('Error: %s\nabort?' % ex):
  1218                     if self.confirm('Error: %s\nabort?' % ex):
  1218                         raise
  1219                         raise
  1219         return res
  1220         return res
  1220 
  1221