equal
deleted
inserted
replaced
961 def check_valid_changes(session, entity, ro_attrs=('name', 'final')): |
961 def check_valid_changes(session, entity, ro_attrs=('name', 'final')): |
962 errors = {} |
962 errors = {} |
963 # don't use getattr(entity, attr), we would get the modified value if any |
963 # don't use getattr(entity, attr), we would get the modified value if any |
964 for attr in ro_attrs: |
964 for attr in ro_attrs: |
965 if attr in entity.edited_attributes: |
965 if attr in entity.edited_attributes: |
966 orival, newval = entity_oldnewvalue(entity, attr) |
966 origval, newval = entity_oldnewvalue(entity, attr) |
967 if newval != origval: |
967 if newval != origval: |
968 errors[attr] = session._("can't change the %s attribute") % \ |
968 errors[attr] = session._("can't change the %s attribute") % \ |
969 display_name(session, attr) |
969 display_name(session, attr) |
970 if errors: |
970 if errors: |
971 raise ValidationError(entity.eid, errors) |
971 raise ValidationError(entity.eid, errors) |