From 27823e784aaf50add807637d3031a118c937ab53 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Benoi=CC=82t=20Pin?= Date: Fri, 10 Oct 2014 15:04:43 +0200 Subject: [PATCH 1/1] =?utf8?q?Bugfix=C2=A0:=20=C3=A0=20l'instanciation=20d?= =?utf8?q?'un=20site=20CMF,=20le=20composant=20Products.CMFCore.interfaces?= =?utf8?q?.IMembershipTool=20n'existe=20pas.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- userlanguages.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 : -- 2.20.1