# HG changeset patch # User Sylvain Thénault # Date 1281109054 -7200 # Node ID 6ebecb217efe9a91c7c10524ee176fa2f5c97ee5 # Parent f2580c7abc266d2b8eaaf4fae37de587dc13d0db [migration] dont crash if a group doesn't exists (it may not exists yet) diff -r f2580c7abc26 -r 6ebecb217efe server/migractions.py --- a/server/migractions.py Fri Aug 06 17:37:06 2010 +0200 +++ b/server/migractions.py Fri Aug 06 17:37:34 2010 +0200 @@ -378,9 +378,13 @@ for gname in newgroups: if not confirm or self.confirm('Grant %s permission of %s to %s?' % (action, erschema, gname)): - self.rqlexec('SET T %s G WHERE G eid %%(x)s, T eid %s' - % (perm, teid), - {'x': gm[gname]}, ask_confirm=False) + try: + self.rqlexec('SET T %s G WHERE G eid %%(x)s, T eid %s' + % (perm, teid), + {'x': gm[gname]}, ask_confirm=False) + except KeyError: + self.error('can grant %s perm to unexistant group %s', + action, gname) # 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, '