Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 670
Mikko Ohtamaa Avatar asked Mar 20 '12 04:03

Mikko Ohtamaa


1 Answers

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

like image 103
Auspex Avatar answered Oct 11 '22 09:10

Auspex