Search code examples
plonearchetypes

Automatic id rename after title change


What could be the best way to achieve a functionality that

  • All items get new id based no title edits automatically, no need to rename items manually

  • This would use the id normalization + counter format used by Plone by default

  • Can be enabled globally for all Archetypes content types


Solution

  • Yuri's on the right track - for a quick and very dirty, I believe this will work:

    context.setTitle('lorem ipsum')
    context.unmarkCreationFlag()
    context.processForm()
    

    Strictly, that's not what the documentation says - as it shouldn't do a rename if it doesn't have the temporary ID generated in the portal factory, but I was getting renaming happening when I modified titles of objects that still had the CreationFlag marked