Ticket #11412 (confirmed Bug)
Mixing Nontranslatable Archetypes Content objects with LinguaPlone creates problems with saving LanguageIndependent fields
Reported by: | do3cc | Owned by: | vincentfretin |
---|---|---|---|
Priority: | minor | Milestone: | 4.x |
Component: | Internationalization | Version: | 4.1 |
Keywords: | linguaplone | Cc: |
Description
On a site with translatable and not translatable content types we encountered some unexpected behaviours. When we published an object based on plone.app.folder.ATFolder, its effective date was not being set. Infact, something higher in the hierarchy got its effective date updated.
It turned out that then paf registers its ATFolder with Products.ATContentTypes.content.registerATCT, The ATContentTypes Code unconditionally used the LinguaPlone registerType method, even though ATFolder does not implement the ITranslatable Interface.
registerType of LinguaPlone generates accessors that assume that the objects for which they provide accessors and mutators implpement ITranslatable.
This is, what happens with the current Implementation when somebody sets the effective date on a paf.ATFolder based object: The LinguaPlone generated Mutator checks that effective Date is LanguageIndependent. Because of that it tries to get translated objects with getTranslations. getTranslations get acquired by the first object higher in the hierarchy that implements the method. The mutator then sets the effective date on the returned object, that has nothing to do with the paf.ATFolder based object.
I am not entirely convinced that this check has to happen in Products.ATContentTypes.content.base or somewhere in Archetypes or if untranslatable Archetypes should be declared as unsupported. So I create a ticket instead of a bugfix for now.
Change History
comment:1 Changed 5 years ago by do3cc
- Summary changed from registerATCT of Products.ATContentTypes.content unconditionally uses registerType of LinguaPlone if available to Mixing Nontranslatable Archetypes Content objects with LinguaPlone creates problems with saving LanguageIndependent fields
comment:2 Changed 4 years ago by kleist
- Status changed from new to confirmed
- Keywords linguaplone added
Which version of Plone? of Linguaplone?
comment:3 Changed 4 years ago by do3cc
- Version set to 4.1
Trunk. The Problem is here: https://github.com/plone/Products.ATContentTypes/blob/a71aceb6594a7f89e7890765c52638dcb89232e2/Products/ATContentTypes/content/base.py#L9 Link not pinned to a specific version: https://github.com/plone/Products.ATContentTypes/blob/master/Products/ATContentTypes/content/base.py#L9
comment:4 Changed 3 years ago by afd
I can confirm this issue as I have tracked it:
It is indeed caused by the fact that p.a.f uses registerATCT instead of registerType. This causes mutators to be generated by LinguaPlone, for any content that inherits p.a.f.Folder. The mutator generated by LP uses the missing getTranslations method and will not change anything in the database (with LP 4.1.3)
Products.ATContentTypes => ATFolder inherits from p.a.f.Folder but also from I18nOnlyBaseBTreeFolder, so old ATCT based Folders are fine.
p.a.f.Folder should also have the same mechanism for LinguaPlone awareness - ex: to inherit from I18nOnlyBaseBTreeFolder, or give up on registerATCT.
Until the issue is fixed, inheritance from p.a.f.Folder is not possible in sites with LP present.
Some details here: http://taskman.eionet.europa.eu/issues/14050