#257 — Destructive modification when getTranslations method is not defined on object

State Resolved
Version: 4.x
Area Functionality
Issue type Bug
Severity Medium
Submitted by Matous Hora
Submitted on Oct 19, 2010
Responsible Hanno Schlichting
Target release: 4.x
If an object does not define getTranslation method (not sure why that happened but is not relevant to the issue), generatedMutator can set fields of parents rather than the object itself (languageIndependent fields)


translations = []
if hasattr(self, 'getTranslations'):
    translations = self.getTranslations(review_state=False).values()

the getTranslation method can be acquired and thus mutator sets different object than the context is

maybe something like this could help:
if base_hasattr(self, 'getTranslations') or
if hasattr(aq_base(self), 'getTranslations')
Added by Hanno Schlichting on Nov 04, 2010 10:45 AM
Issue state: UnconfirmedResolved
Responsible manager: (UNASSIGNED)hannosch
Target release: None4.x
Thanks for the report. I fixed it using the aq_base(self) approach. This fix is available in SVN, will make it into the next 3.2b2 and 4.0b2 releases.

No responses can be added.