Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
58324d68
Commit
58324d68
authored
May 21, 2010
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge fix for LP#142878 from 2.12 branch.
parent
0d876e35
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
27 deletions
+21
-27
doc/CHANGES.rst
doc/CHANGES.rst
+3
-0
src/Products/SiteAccess/AccessRule.py
src/Products/SiteAccess/AccessRule.py
+0
-12
src/Products/SiteAccess/SiteRoot.py
src/Products/SiteAccess/SiteRoot.py
+0
-5
src/Products/SiteAccess/tests/testAccessRule.py
src/Products/SiteAccess/tests/testAccessRule.py
+3
-3
src/Products/SiteAccess/tests/testSiteRoot.py
src/Products/SiteAccess/tests/testSiteRoot.py
+15
-7
No files found.
doc/CHANGES.rst
View file @
58324d68
...
@@ -162,6 +162,9 @@ Features Added
...
@@ -162,6 +162,9 @@ Features Added
Bugs
Fixed
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
``
-
LP
#
143144
:
Fix
documentation
for
the
zope
.
conf
``
mount
-
point
``
directive
.
directive
.
...
...
src/Products/SiteAccess/AccessRule.py
View file @
58324d68
...
@@ -20,20 +20,8 @@ class AccessRule(NameCaller):
...
@@ -20,20 +20,8 @@ class AccessRule(NameCaller):
def
__call__
(
self
,
container
,
request
):
def
__call__
(
self
,
container
,
request
):
if
SUPPRESS_ACCESSRULE
:
if
SUPPRESS_ACCESSRULE
:
return
return
if
'_SUPPRESS_ACCESSRULE'
in
_swallow
(
request
,
'_SUPPRESS'
):
request
.
setVirtualRoot
(
request
.
steps
)
return
NameCaller
.
__call__
(
self
,
container
,
request
)
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
):
def
manage_addAccessRule
(
self
,
method_id
=
None
,
REQUEST
=
None
,
**
ignored
):
"""Point a __before_traverse__ entry at the specified method"""
"""Point a __before_traverse__ entry at the specified method"""
...
...
src/Products/SiteAccess/SiteRoot.py
View file @
58324d68
...
@@ -14,8 +14,6 @@ from ZPublisher.BeforeTraverse import NameCaller
...
@@ -14,8 +14,6 @@ from ZPublisher.BeforeTraverse import NameCaller
from
ZPublisher.BeforeTraverse
import
registerBeforeTraverse
from
ZPublisher.BeforeTraverse
import
registerBeforeTraverse
from
ZPublisher.BeforeTraverse
import
unregisterBeforeTraverse
from
ZPublisher.BeforeTraverse
import
unregisterBeforeTraverse
from
Products.SiteAccess.AccessRule
import
_swallow
SUPPRESS_SITEROOT
=
os
.
environ
.
has_key
(
'SUPPRESS_SITEROOT'
)
SUPPRESS_SITEROOT
=
os
.
environ
.
has_key
(
'SUPPRESS_SITEROOT'
)
class
Traverser
(
Persistent
,
Item
):
class
Traverser
(
Persistent
,
Item
):
...
@@ -103,9 +101,6 @@ class SiteRoot(Traverser, Implicit):
...
@@ -103,9 +101,6 @@ class SiteRoot(Traverser, Implicit):
rq
=
request
rq
=
request
if
SUPPRESS_SITEROOT
:
if
SUPPRESS_SITEROOT
:
return
return
if
'_SUPPRESS_SITEROOT'
in
_swallow
(
rq
,
'_SUPPRESS'
):
rq
.
setVirtualRoot
(
rq
.
steps
)
return
base
=
(
self
.
base
or
base
=
(
self
.
base
or
rq
.
get
(
'SiteRootBASE'
)
or
rq
.
get
(
'SiteRootBASE'
)
or
rq
.
environ
.
get
(
'SiteRootBASE'
))
rq
.
environ
.
get
(
'SiteRootBASE'
))
...
...
src/Products/SiteAccess/tests/testAccessRule.py
View file @
58324d68
...
@@ -37,7 +37,7 @@ class AccessRuleTests(unittest.TestCase):
...
@@ -37,7 +37,7 @@ class AccessRuleTests(unittest.TestCase):
self
.
failIf
(
_called
)
self
.
failIf
(
_called
)
def
test___call___w_SUPPRESS_ACCESSRULE_in_URL
(
self
):
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
=
[]
_called
=
[]
def
_func
(
*
args
):
def
_func
(
*
args
):
_called
.
append
(
args
)
_called
.
append
(
args
)
...
@@ -47,8 +47,8 @@ class AccessRuleTests(unittest.TestCase):
...
@@ -47,8 +47,8 @@ class AccessRuleTests(unittest.TestCase):
request
.
steps
=
[]
request
.
steps
=
[]
container
=
DummyContainer
(
testing
=
_func
)
container
=
DummyContainer
(
testing
=
_func
)
rule
(
container
,
request
)
rule
(
container
,
request
)
self
.
fail
If
(
_called
)
self
.
fail
Unless
(
_called
)
self
.
assertEqual
(
request
.
_virtual_root
,
[
'_SUPPRESS_ACCESSRULE'
]
)
self
.
assertEqual
(
request
.
_virtual_root
,
None
)
def
test___call___wo_SUPPRESS_ACCESSRULE
(
self
):
def
test___call___wo_SUPPRESS_ACCESSRULE
(
self
):
_called
=
[]
_called
=
[]
...
...
src/Products/SiteAccess/tests/testSiteRoot.py
View file @
58324d68
...
@@ -166,16 +166,24 @@ class SiteRootTests(unittest.TestCase):
...
@@ -166,16 +166,24 @@ class SiteRootTests(unittest.TestCase):
self
.
assertEqual
(
request
,
{})
self
.
assertEqual
(
request
,
{})
def
test___call___w_SUPPRESS_SITEROOT_in_URL
(
self
):
def
test___call___w_SUPPRESS_SITEROOT_in_URL
(
self
):
# This behavior will change once we land lp:142878.
# This behavior changed in landing lp:142878.
siteroot
=
self
.
_makeOne
(
base
=
'http://example.com'
,
path
=
'/path'
)
URL
=
'http://localhost:8080/example/folder/'
siteroot
=
self
.
_makeOne
(
base
=
'http://example.com'
,
path
=
'/example'
)
request
=
DummyRequest
(
TraversalRequestNameStack
=
request
=
DummyRequest
(
TraversalRequestNameStack
=
[
'_SUPPRESS_SITEROOT'
])
[
'_SUPPRESS_SITEROOT'
],
def
_dont_go_here
(
key
,
value
):
URL
=
URL
,
raise
NotImplementedError
ACTUAL_URL
=
URL
,
request
.
__setitem__
=
_dont_go_here
SERVER_URL
=
'http://localhost:8080'
,
)
request
.
steps
=
[]
request
.
steps
=
[]
request
.
environ
=
{}
siteroot
(
None
,
request
)
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
):
def
test___call___wo_SUPPRESS_SITEROOT_w_base_wo_path
(
self
):
URL
=
'http://localhost:8080/example/folder/'
URL
=
'http://localhost:8080/example/folder/'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment