check name changed first stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 17 Dec 2009 16:17:57 +0100
branchstable
changeset 4129 887e3edc30c5
parent 4125 a32b0dc8575c
child 4130 9560ff49b2db
check name changed first
server/schemahooks.py
--- a/server/schemahooks.py	Wed Dec 16 09:11:41 2009 +0100
+++ b/server/schemahooks.py	Thu Dec 17 16:17:57 2009 +0100
@@ -974,10 +974,11 @@
     """check name change, handle final"""
     check_valid_changes(session, entity, ro_attrs=('final',))
     # don't use getattr(entity, attr), we would get the modified value if any
-    oldname, newname = entity_oldnewvalue(entity, 'name')
-    if newname.lower() != oldname.lower():
-        SourceDbCWETypeRename(session, oldname=oldname, newname=newname)
-        MemSchemaCWETypeRename(session, oldname=oldname, newname=newname)
+    if 'name' in entity.edited_attributes:
+        oldname, newname = entity_oldnewvalue(entity, 'name')
+        if newname.lower() != oldname.lower():
+            SourceDbCWETypeRename(session, oldname=oldname, newname=newname)
+            MemSchemaCWETypeRename(session, oldname=oldname, newname=newname)
 
 def before_update_ertype(session, entity):
     """check name change, handle final"""