Open zopyx opened 2 years ago
Is 'de' in the allowed languages of the new site?
In our current project, we have item language exported from Plone 4.3.20 as "language": "en"
and if the target Plone Site doesn't allow en
we get the deserialization error. otherwise it gets imported correctly.
I have this in custom code, which fixes the problem for my case (export example content from English site, import it in Spanish site):
class CustomImportContent(ImportContent):
def global_dict_hook(self, item):
# When we export English content and import it in the Spanish site,
# we must change the langue to Spanish, otherwise you get an error:
# zExceptions.BadRequest: [{'message': 'Constraint not satisfied',
# 'field': 'language', 'error': 'ValidationError'}]
# BTW, the value is for example:
# {'title': 'Nederlands', 'token': 'nl'}
# Hey, wouldn't the easiest be to drop the key? Seems to work fine.
# Alternatively, use self.context.Language(), so a language is really set.
# This might be better for multilingual sites.
language = item.pop("language", None)
if language is not None:
logger.info("Popped language %s from item.", language)
return item
I have a Plone 5.2 AT site that exports most of the content with
and some content items as
This leads to import errors such as