Commit 21c89103 authored by Julien Muchembled's avatar Julien Muchembled

Do not fail if there is no request when calling setSite on Zope 2.8

Although this could be an issue, getSite is not used for the moment.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38690 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c74c7abd
...@@ -18,7 +18,7 @@ except ImportError: ...@@ -18,7 +18,7 @@ except ImportError:
return None return None
def _setSite(site=None): def _setSite(site=None):
request = Globals.get_request() request = Globals.get_request()
if site is not None and site not in request.get('PARENTS', ()): if not (None in (site, request) or site in request.get('PARENTS', ())):
request['PARENTS'] = [site] request['PARENTS'] = [site]
# patch getSite so that it works everywhere # patch getSite so that it works everywhere
...@@ -34,7 +34,6 @@ def getSite(): ...@@ -34,7 +34,6 @@ def getSite():
return site return site
hooks.getSite = getSite hooks.getSite = getSite
last_cookie_value = None
def setSite(site=None): def setSite(site=None):
_setSite(site) _setSite(site)
if site is not None: if site is not None:
......
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