Log message for revision 112622: Remove URL-based suppression of access rules and site root objects. Suppression using ``os.environ`` still works. Fixes LP #142878.
Changed: U Zope/branches/2.12/doc/CHANGES.rst U Zope/branches/2.12/src/Products/SiteAccess/AccessRule.py U Zope/branches/2.12/src/Products/SiteAccess/SiteRoot.py U Zope/branches/2.12/src/Products/SiteAccess/tests/testAccessRule.py U Zope/branches/2.12/src/Products/SiteAccess/tests/testSiteRoot.py -=- Modified: Zope/branches/2.12/doc/CHANGES.rst =================================================================== --- Zope/branches/2.12/doc/CHANGES.rst 2010-05-21 15:20:02 UTC (rev 112621) +++ Zope/branches/2.12/doc/CHANGES.rst 2010-05-21 15:20:04 UTC (rev 112622) @@ -11,6 +11,9 @@ Bugs Fixed ++++++++++ +- LP #142878: Remove URL-based suppression of access rules and site root + objects. Suppression using ``os.environ`` still works. + - LP #143144: Fix documentation for the zope.conf ``mount-point`` directive. Modified: Zope/branches/2.12/src/Products/SiteAccess/AccessRule.py =================================================================== --- Zope/branches/2.12/src/Products/SiteAccess/AccessRule.py 2010-05-21 15:20:02 UTC (rev 112621) +++ Zope/branches/2.12/src/Products/SiteAccess/AccessRule.py 2010-05-21 15:20:04 UTC (rev 112622) @@ -20,20 +20,8 @@ def __call__(self, container, request): if SUPPRESS_ACCESSRULE: return - if '_SUPPRESS_ACCESSRULE' in _swallow(request, '_SUPPRESS'): - request.setVirtualRoot(request.steps) - return NameCaller.__call__(self, container, request) -def _swallow(request, prefix): - path = request['TraversalRequestNameStack'] - steps = request.steps - i = len(steps) - while i > 0 and steps[i - 1][:1] == '_': - i = i - 1 - while path and path[-1][:len(prefix)] == prefix: - steps.append(path.pop()) - return steps[i:] def manage_addAccessRule(self, method_id=None, REQUEST=None, **ignored): """Point a __before_traverse__ entry at the specified method""" Modified: Zope/branches/2.12/src/Products/SiteAccess/SiteRoot.py =================================================================== --- Zope/branches/2.12/src/Products/SiteAccess/SiteRoot.py 2010-05-21 15:20:02 UTC (rev 112621) +++ Zope/branches/2.12/src/Products/SiteAccess/SiteRoot.py 2010-05-21 15:20:04 UTC (rev 112622) @@ -14,8 +14,6 @@ from ZPublisher.BeforeTraverse import registerBeforeTraverse from ZPublisher.BeforeTraverse import unregisterBeforeTraverse -from Products.SiteAccess.AccessRule import _swallow - SUPPRESS_SITEROOT = os.environ.has_key('SUPPRESS_SITEROOT') class Traverser(Persistent, Item): @@ -103,9 +101,6 @@ rq = request if SUPPRESS_SITEROOT: return - if '_SUPPRESS_SITEROOT' in _swallow(rq, '_SUPPRESS'): - rq.setVirtualRoot(rq.steps) - return base = (self.base or rq.get('SiteRootBASE') or rq.environ.get('SiteRootBASE')) Modified: Zope/branches/2.12/src/Products/SiteAccess/tests/testAccessRule.py =================================================================== --- Zope/branches/2.12/src/Products/SiteAccess/tests/testAccessRule.py 2010-05-21 15:20:02 UTC (rev 112621) +++ Zope/branches/2.12/src/Products/SiteAccess/tests/testAccessRule.py 2010-05-21 15:20:04 UTC (rev 112622) @@ -37,7 +37,7 @@ self.failIf(_called) def test___call___w_SUPPRESS_ACCESSRULE_in_URL(self): - # This behavior will change once we land lp:142878. + # This behavior changed in landing lp:142878. _called = [] def _func(*args): _called.append(args) @@ -47,8 +47,8 @@ request.steps = [] container = DummyContainer(testing=_func) rule(container, request) - self.failIf(_called) - self.assertEqual(request._virtual_root, ['_SUPPRESS_ACCESSRULE']) + self.failUnless(_called) + self.assertEqual(request._virtual_root, None) def test___call___wo_SUPPRESS_ACCESSRULE(self): _called = [] Modified: Zope/branches/2.12/src/Products/SiteAccess/tests/testSiteRoot.py =================================================================== --- Zope/branches/2.12/src/Products/SiteAccess/tests/testSiteRoot.py 2010-05-21 15:20:02 UTC (rev 112621) +++ Zope/branches/2.12/src/Products/SiteAccess/tests/testSiteRoot.py 2010-05-21 15:20:04 UTC (rev 112622) @@ -166,16 +166,24 @@ self.assertEqual(request, {}) def test___call___w_SUPPRESS_SITEROOT_in_URL(self): - # This behavior will change once we land lp:142878. - siteroot = self._makeOne(base='http://example.com', path='/path') + # This behavior changed in landing lp:142878. + URL='http://localhost:8080/example/folder/' + siteroot = self._makeOne(base='http://example.com', path='/example') request = DummyRequest(TraversalRequestNameStack= - ['_SUPPRESS_SITEROOT']) - def _dont_go_here(key, value): - raise NotImplementedError - request.__setitem__ = _dont_go_here + ['_SUPPRESS_SITEROOT'], + URL=URL, + ACTUAL_URL=URL, + SERVER_URL='http://localhost:8080', + ) request.steps = [] + request.environ = {} siteroot(None, request) - self.assertEqual(request._virtual_root, ['_SUPPRESS_SITEROOT']) + self.assertEqual(request['URL'], URL) + self.assertEqual(request['SERVER_URL'], 'http://example.com') + self.assertEqual(request['ACTUAL_URL'], + 'http://example.com/example/folder/') + self.assertEqual(request._virtual_root, '/example') + self.failUnless(request._urls_reset) def test___call___wo_SUPPRESS_SITEROOT_w_base_wo_path(self): URL='http://localhost:8080/example/folder/' _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org https://mail.zope.org/mailman/listinfo/zope-checkins