Skip to content

Commit

Permalink
use uuidToObject to get the object from UUID
Browse files Browse the repository at this point in the history
  • Loading branch information
erral committed Sep 30, 2024
1 parent 2184940 commit 12c3985
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/plone/app/multilingual/browser/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
from plone.app.multilingual import _
from plone.app.multilingual.interfaces import IMultiLanguageExtraOptionsSchema
from plone.app.multilingual.interfaces import ITranslationManager
from plone.app.uuid.utils import uuidToObject
from plone.base.interfaces import ILanguage
from plone.registry.interfaces import IRegistry
from plone.uuid.interfaces import IUUID
from Products.CMFCore.utils import getToolByName
from Products.Five import BrowserView
from zope.component import getUtility

Expand Down Expand Up @@ -63,10 +63,8 @@ def __call__(self):
# try with context if no translation uid is present
manager = ITranslationManager(self.context)
else:
catalog = getToolByName(self.context, "portal_catalog")
brains = catalog(UID=context_uid)
if len(brains):
context = brains[0].getObject()
context = uuidToObject(context_uid)
if context is not None:
manager = ITranslationManager(context)
else:
manager = ITranslationManager(self.context)
Expand Down

0 comments on commit 12c3985

Please sign in to comment.