def assign_new_version_id(obj, event): """Assigns a version id to newly created objects """ # 70786 avoid adding new versions to objects found in portal_factory # during creating and saving of object this event is called 8 times # and we only need to apply a version to the object when it is out of # portal_factory if 'portal_factory' in obj.absolute_url(): return version_id = IAnnotations(obj).get(VERSION_ID) if not version_id: IAnnotations(obj)[VERSION_ID] = new_version_id(obj)
def revoke_version(context): """ Assigns a new random id to context, make it split from it version group """ IVersionControl(context).setVersionId(new_version_id(context))