# HG changeset patch # User Sylvain Thénault # Date 1373530842 -7200 # Node ID bf0a575d8da806475026135719c4536a85de574b # Parent 7b51daf84a66bf074f7091e7fb7af8182805c0e7 [migraction] rename_entity_type simply warn if old entity type isn't in the schema. Closes #3004069 diff -r 7b51daf84a66 -r bf0a575d8da8 server/migractions.py --- a/server/migractions.py Thu Jul 11 10:15:25 2013 +0200 +++ b/server/migractions.py Thu Jul 11 10:20:42 2013 +0200 @@ -1,4 +1,4 @@ -# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This file is part of CubicWeb. @@ -929,6 +929,10 @@ `newname` is a string giving the name of the renamed entity type """ schema = self.repo.schema + if oldname not in schema: + print 'warning: entity type %s is unknown, skip renaming' % oldname + return + # if merging two existing entity types if newname in schema: assert oldname in ETYPE_NAME_MAP, \ '%s should be mapped to %s in ETYPE_NAME_MAP' % (oldname, @@ -1003,6 +1007,7 @@ # remove the old type: use rql to propagate deletion self.rqlexec('DELETE CWEType ET WHERE ET name %(on)s', {'on': oldname}, ask_confirm=False) + # elif simply renaming an entity type else: self.rqlexec('SET ET name %(newname)s WHERE ET is CWEType, ET name %(on)s', {'newname' : unicode(newname), 'on' : oldname},