X-Git-Url: https://scm.cri.mines-paristech.fr/git/Plinn.git/blobdiff_plain/72b8caf6afd0d09aa829ad9aecd78bc14c92932d..a8b15d47c663e72be4c3102486c7b7fdca467901:/userlanguages.py?ds=sidebyside diff --git a/userlanguages.py b/userlanguages.py index 40fca2a..d108c40 100644 --- a/userlanguages.py +++ b/userlanguages.py @@ -1,11 +1,15 @@ # -*- coding: utf-8 -*- from zope.publisher.browser import BrowserLanguages from Products.CMFCore.utils import getUtilityByInterfaceName +from zope.component.interfaces import ComponentLookupError class AuthenticatedUserLanguages(BrowserLanguages): def getPreferredLanguages(self) : - mtool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IMembershipTool') + try : + mtool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IMembershipTool') + except ComponentLookupError : + return super(AuthenticatedUserLanguages, self).getPreferredLanguages() if mtool.isAnonymousUser() : return super(AuthenticatedUserLanguages, self).getPreferredLanguages() else :