projects
/
Plinn.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Maj localisation.
[Plinn.git]
/
userlanguages.py
diff --git
a/userlanguages.py
b/userlanguages.py
index
8103d15
..
d108c40
100644
(file)
--- a/
userlanguages.py
+++ b/
userlanguages.py
@@
-1,14
+1,18
@@
# -*- coding: utf-8 -*-
from zope.publisher.browser import BrowserLanguages
from Products.CMFCore.utils import getUtilityByInterfaceName
# -*- 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) :
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 :
m = mtool.getAuthenticatedMember()
if mtool.isAnonymousUser() :
return super(AuthenticatedUserLanguages, self).getPreferredLanguages()
else :
m = mtool.getAuthenticatedMember()
- userLangs = m.getProperty('preferred_languages', [])
+ userLangs = m.getProperty('preferred_languages', [])
[:]
return userLangs or super(AuthenticatedUserLanguages, self).getPreferredLanguages()
return userLangs or super(AuthenticatedUserLanguages, self).getPreferredLanguages()