You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# ugly heuristic (searching for something like 'de', 'en' etc.)
iflen(splitted) >1andlen(splitted[-1]) ==2:
content_id="-".join(splitted[:-1])
whilecontent_idinparent.objectIds():
content_id=f"{content_id}-{language}"
returncontent_id
It should regenerate a new id in the context of the new parent.
If I have an id like items-74, it tries to name the translation as items, which triggers:
Module plone.app.multilingual.api, line 46, in translate
Module plone.app.multilingual.manager, line 135, in add_translation
Module plone.app.multilingual.factory, line 93, in __call__
Module plone.dexterity.content, line 808, in invokeFactory
Module Products.CMFCore.PortalFolder, line 299, in invokeFactory
Module Products.CMFCore.TypesTool, line 809, in constructContent
Module Products.CMFCore.TypesTool, line 308, in constructInstance
Module Products.CMFCore.TypesTool, line 570, in _constructInstance
Module Products.BTreeFolder2.BTreeFolder2, line 436, in _setObject
Module plone.folder.ordered, line 253, in _checkId
Module Products.CMFCore.PortalFolder, line 318, in _checkId
Module OFS.ObjectManager, line 125, in checkValidId
zExceptions.BadRequest: The id "items" is invalid - it is already in use
The text was updated successfully, but these errors were encountered:
Hey, I can work on this. In the given example, either content_id is not in parent.objectIds() or 'language' argument is empty. Please let me know how a new id must be generated in these cases. Thanks.
plone.app.multilingual/src/plone/app/multilingual/factory.py
Lines 68 to 76 in 6325639
It should regenerate a new id in the context of the new parent.
If I have an id like
items-74
, it tries to name the translation asitems
, which triggers:The text was updated successfully, but these errors were encountered: