diff -r 73760bbb66bd -r 78438ad513ca server/migractions.py --- a/server/migractions.py Wed Apr 07 09:24:00 2010 +0200 +++ b/server/migractions.py Wed Apr 07 14:26:35 2010 +0200 @@ -268,9 +268,9 @@ if self.session: self.session.set_pool() - def rqlexecall(self, rqliter, cachekey=None, ask_confirm=True): + def rqlexecall(self, rqliter, ask_confirm=True): for rql, kwargs in rqliter: - self.rqlexec(rql, kwargs, cachekey, ask_confirm=ask_confirm) + self.rqlexec(rql, kwargs, ask_confirm=ask_confirm) @cached def _create_context(self): @@ -361,14 +361,14 @@ # handle groups newgroups = list(erschema.get_groups(action)) for geid, gname in self.rqlexec('Any G, GN WHERE T %s G, G name GN, ' - 'T eid %%(x)s' % perm, {'x': teid}, 'x', + 'T eid %%(x)s' % perm, {'x': teid}, ask_confirm=False): if not gname in newgroups: if not confirm or self.confirm('Remove %s permission of %s to %s?' % (action, erschema, gname)): self.rqlexec('DELETE T %s G WHERE G eid %%(x)s, T eid %s' % (perm, teid), - {'x': geid}, 'x', ask_confirm=False) + {'x': geid}, ask_confirm=False) else: newgroups.remove(gname) for gname in newgroups: @@ -376,7 +376,7 @@ % (action, erschema, gname)): self.rqlexec('SET T %s G WHERE G eid %%(x)s, T eid %s' % (perm, teid), - {'x': gm[gname]}, 'x', ask_confirm=False) + {'x': gm[gname]}, ask_confirm=False) # handle rql expressions newexprs = dict((expr.expression, expr) for expr in erschema.get_rqlexprs(action)) for expreid, expression in self.rqlexec('Any E, EX WHERE T %s E, E expression EX, ' @@ -388,7 +388,7 @@ # deleting the relation will delete the expression entity self.rqlexec('DELETE T %s E WHERE E eid %%(x)s, T eid %s' % (perm, teid), - {'x': expreid}, 'x', ask_confirm=False) + {'x': expreid}, ask_confirm=False) else: newexprs.pop(expression) for expression in newexprs.values(): @@ -399,7 +399,7 @@ 'X expression %%(expr)s, X mainvars %%(vars)s, T %s X ' 'WHERE T eid %%(x)s' % perm, {'expr': expr, 'exprtype': exprtype, - 'vars': expression.mainvars, 'x': teid}, 'x', + 'vars': expression.mainvars, 'x': teid}, ask_confirm=False) def _synchronize_rschema(self, rtype, syncrdefs=True, syncperms=True, syncprops=True): @@ -524,14 +524,13 @@ newcstr = None if newcstr is None: self.rqlexec('DELETE X constrained_by C WHERE C eid %(x)s', - {'x': cstr.eid}, 'x', - ask_confirm=confirm) + {'x': cstr.eid}, ask_confirm=confirm) else: newconstraints.remove(newcstr) value = unicode(newcstr.serialize()) if value != unicode(cstr.serialize()): self.rqlexec('SET X value %(v)s WHERE X eid %(x)s', - {'x': cstr.eid, 'v': value}, 'x', + {'x': cstr.eid, 'v': value}, ask_confirm=confirm) # 2. add new constraints cstrtype_map = self.cstrtype_mapping() @@ -644,10 +643,10 @@ self.cmd_drop_relation_definition( str(fromtype), rschema.type, str(totype)) # execute post-remove files - for pack in reversed(removedcubes): - self.exec_event_script('postremove', self.config.cube_dir(pack)) + for cube in reversed(removedcubes): + self.exec_event_script('postremove', self.config.cube_dir(cube)) self.rqlexec('DELETE CWProperty X WHERE X pkey %(pk)s', - {'pk': u'system.version.'+pack}, ask_confirm=False) + {'pk': u'system.version.'+cube}, ask_confirm=False) self.commit() # schema migration actions ################################################ @@ -736,8 +735,8 @@ continue if instspschema.specializes() != eschema: self.rqlexec('SET D specializes P WHERE D eid %(d)s, P name %(pn)s', - {'d': instspschema.eid, - 'pn': eschema.type}, ask_confirm=confirm) + {'d': instspschema.eid, 'pn': eschema.type}, + ask_confirm=confirm) for rschema, tschemas, role in spschema.relation_definitions(True): for tschema in tschemas: if not tschema in instschema: @@ -1073,12 +1072,12 @@ for etype in wfof: rset = self.rqlexec( 'SET X workflow_of ET WHERE X eid %(x)s, ET name %(et)s', - {'x': wf.eid, 'et': etype}, 'x', ask_confirm=False) + {'x': wf.eid, 'et': etype}, ask_confirm=False) assert rset, 'unexistant entity type %s' % etype if default: self.rqlexec( 'SET ET default_workflow X WHERE X eid %(x)s, ET name %(et)s', - {'x': wf.eid, 'et': etype}, 'x', ask_confirm=False) + {'x': wf.eid, 'et': etype}, ask_confirm=False) if commit: self.commit() return wf @@ -1202,6 +1201,9 @@ def rqlexec(self, rql, kwargs=None, cachekey=None, build_descr=True, ask_confirm=True): """rql action""" + if cachekey is not None: + warn('[3.8] cachekey is deprecated, you can safely remove this argument', + DeprecationWarning, stacklevel=2) if not isinstance(rql, (tuple, list)): rql = ( (rql, kwargs), ) res = None @@ -1213,7 +1215,7 @@ msg = rql if not ask_confirm or self.confirm('Execute rql: %s ?' % msg): try: - res = execute(rql, kwargs, cachekey, build_descr=build_descr) + res = execute(rql, kwargs, build_descr=build_descr) except Exception, ex: if self.confirm('Error: %s\nabort?' % ex): raise