I'm having a problem with a doctest because I'm trying to rename the IDs of a content type object in an IObjectAddedEvent handler. My requirement is to have IDs that are sequential and context specific eg CAM-001, CAM-002, BLK-001, BLK-002, etc
When I add a object manually in the browser the event handler renames the id correctly but when I try create it in a doctest it fails soon after it is added to it's container. plone.dexterity addContentToContainer calls _setObject with the original id, then the event handler kicks in and renames the id, and then when _getObject uses original id it obviously can't find the object so it bomb with an attribute error.
I created a product to illustrate this here https://github.com/mikejmets/wt.testrig.
I also tried using plone.api in the doctest but that also fails.
All ideas welcome.