Commit a7b83cd5 authored by Vincent Pelletier's avatar Vincent Pelletier

Woops again, I'm caching brains. Cache paths instead.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15329 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 96d57ec3
...@@ -173,6 +173,8 @@ class ERP5UserManager(BasePlugin): ...@@ -173,6 +173,8 @@ class ERP5UserManager(BasePlugin):
if not login: if not login:
return [] return []
portal = self.getPortalObject()
def _getUserByLogin(login): def _getUserByLogin(login):
# because we aren't logged in, we have to create our own # because we aren't logged in, we have to create our own
# SecurityManager to be able to access the Catalog # SecurityManager to be able to access the Catalog
...@@ -182,7 +184,7 @@ class ERP5UserManager(BasePlugin): ...@@ -182,7 +184,7 @@ class ERP5UserManager(BasePlugin):
try: try:
try: try:
result = self.getPortalObject().portal_catalog.unrestrictedSearchResults( result = portal.portal_catalog.unrestrictedSearchResults(
portal_type="Person", reference=login) portal_type="Person", reference=login)
except ConflictError: except ConflictError:
raise raise
...@@ -197,12 +199,12 @@ class ERP5UserManager(BasePlugin): ...@@ -197,12 +199,12 @@ class ERP5UserManager(BasePlugin):
raise _SWALLOWABLE_PLUGIN_EXCEPTIONS[0] raise _SWALLOWABLE_PLUGIN_EXCEPTIONS[0]
finally: finally:
setSecurityManager(sm) setSecurityManager(sm)
return result return [x.path for x in result]
_getUserByLogin = CachingMethod(_getUserByLogin, _getUserByLogin = CachingMethod(_getUserByLogin,
id='ERP5UserManager_getUserByLogin', id='ERP5UserManager_getUserByLogin',
cache_factory='erp5_content_short') cache_factory='erp5_content_short')
result = _getUserByLogin(login) result = _getUserByLogin(login)
return [item.getObject() for item in result] return [portal.unrestrictedTraverse(x) for x in result]
classImplements( ERP5UserManager classImplements( ERP5UserManager
, IAuthenticationPlugin , IAuthenticationPlugin
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment