plone/plone.multilingualbehavior — pull request #7 by pysailor (2014-02-16 16:49:20+00:00)
Title: Use IEditFinishedEvent instead for IObjectModifiedEvent for triggering language-independent handling

IObjectModifiedEvent is too general and can get thrown multiple times for a single edit. This becomes a problem especially when more than a handful of translations are present. This causes a major lag, since the lang-independent fields are copied multiple times, and reindexing also happens multiple times.

(In my Plone 4.3.2 with p.a.contenttypes 1.1a1 the IObjectModifiedEvent and therefore the handle_modified handler gets called 16 times every time content such as a Folder is edited.)

The more specific IEditFinishedEvent from plone.dexterity really gets thrown only once, when the actual editing has been performed. Only then should the lang-independent fields be copied.

I had to adjust two tests, but the only change is that I now notify IEditFinishedEvent instead of IObjectModifiedEvent. The tests are still passing. In my site with actual data and 25 languages, this change leads to a massive speedup when saving, while lang-independent fields still get copied.

Is there any reason why listening to IEditFinishedEvent is a bad idea (e.g. too late in the process)?