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
1c5e7ba1
Commit
1c5e7ba1
authored
May 21, 2010
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Formatting.
parent
fbf16d96
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
17 deletions
+26
-17
src/Products/SiteAccess/SiteRoot.py
src/Products/SiteAccess/SiteRoot.py
+26
-17
No files found.
src/Products/SiteAccess/SiteRoot.py
View file @
1c5e7ba1
...
@@ -19,12 +19,12 @@ from Products.SiteAccess.AccessRule import _swallow
...
@@ -19,12 +19,12 @@ 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
):
"""Class for overriding container's __before_traverse__
"""
Class for overriding container's __before_traverse__
Containers are expected to have at most one instance of any particular
Containers are expected to have at most one instance of any particular
subclass, with Id equal to the meta_type of the subclass.
"""
subclass, with Id equal to the meta_type of the subclass.
"""
meta_type
=
'Traverser'
meta_type
=
'Traverser'
priority
=
100
priority
=
100
__ac_permissions__
=
()
__ac_permissions__
=
()
...
@@ -66,22 +66,24 @@ class Traverser(Persistent, Item):
...
@@ -66,22 +66,24 @@ class Traverser(Persistent, Item):
%
escape
(
self
.
meta_type
))
%
escape
(
self
.
meta_type
))
class
SiteRoot
(
Traverser
,
Implicit
):
class
SiteRoot
(
Traverser
,
Implicit
):
"""SiteAccess.SiteRoot object
"""
SiteAccess.SiteRoot object
A SiteRoot causes traversal of its container to replace the part
A SiteRoot causes traversal of its container to replace the part
of the Request path traversed so far with the request's SiteRootURL.
"""
of the Request path traversed so far with the request's SiteRootURL.
"""
id
=
meta_type
=
'SiteRoot'
id
=
meta_type
=
'SiteRoot'
title
=
''
title
=
''
priority
=
50
priority
=
50
manage_options
=
({
'label'
:
'Edit'
,
'action'
:
'manage_main'
,
'help'
:
(
'SiteAccess'
,
'SiteRoot_Edit.stx'
)},)
manage_options
=
({
'label'
:
'Edit'
,
'action'
:
'manage_main'
,
'help'
:
(
'SiteAccess'
,
'SiteRoot_Edit.stx'
),
},)
manage
=
manage_main
=
DTMLFile
(
'www/SiteRootEdit'
,
globals
())
manage
=
manage_main
=
DTMLFile
(
'www/SiteRootEdit'
,
globals
())
manage_main
.
_setName
(
'manage_main'
)
manage_main
.
_setName
(
'manage_main'
)
def
__init__
(
self
,
title
,
base
,
path
):
def
__init__
(
self
,
title
,
base
,
path
):
'''Title'''
self
.
title
=
title
.
strip
()
self
.
title
=
title
.
strip
()
self
.
base
=
base
=
base
.
strip
()
self
.
base
=
base
=
base
.
strip
()
self
.
path
=
path
=
path
.
strip
()
self
.
path
=
path
=
path
.
strip
()
...
@@ -95,7 +97,8 @@ class SiteRoot(Traverser, Implicit):
...
@@ -95,7 +97,8 @@ class SiteRoot(Traverser, Implicit):
except
:
pass
except
:
pass
def
manage_edit
(
self
,
title
,
base
,
path
,
REQUEST
=
None
):
def
manage_edit
(
self
,
title
,
base
,
path
,
REQUEST
=
None
):
'''Set the title, base, and path'''
""" Set the title, base, and path.
"""
self
.
__init__
(
title
,
base
,
path
)
self
.
__init__
(
title
,
base
,
path
)
if
REQUEST
:
if
REQUEST
:
return
MessageDialog
(
title
=
'SiteRoot changed.'
,
return
MessageDialog
(
title
=
'SiteRoot changed.'
,
...
@@ -103,8 +106,10 @@ class SiteRoot(Traverser, Implicit):
...
@@ -103,8 +106,10 @@ class SiteRoot(Traverser, Implicit):
action
=
'%s/manage_main'
%
REQUEST
[
'URL1'
])
action
=
'%s/manage_main'
%
REQUEST
[
'URL1'
])
def
__call__
(
self
,
client
,
request
,
response
=
None
):
def
__call__
(
self
,
client
,
request
,
response
=
None
):
'''Traversing'''
""" Traversing.
if
SUPPRESS_SITEROOT
:
return
"""
if
SUPPRESS_SITEROOT
:
return
if
'_SUPPRESS_SITEROOT'
in
_swallow
(
request
,
'_SUPPRESS'
):
if
'_SUPPRESS_SITEROOT'
in
_swallow
(
request
,
'_SUPPRESS'
):
request
.
setVirtualRoot
(
request
.
steps
)
request
.
setVirtualRoot
(
request
.
steps
)
return
return
...
@@ -118,22 +123,26 @@ class SiteRoot(Traverser, Implicit):
...
@@ -118,22 +123,26 @@ class SiteRoot(Traverser, Implicit):
if
srd
[
i
]
is
None
:
if
srd
[
i
]
is
None
:
srd
[
i
]
=
request
.
environ
.
get
(
srp
,
None
)
srd
[
i
]
=
request
.
environ
.
get
(
srp
,
None
)
if
srd
[
0
]
is
not
None
:
if
srd
[
0
]
is
not
None
:
request
[
'ACTUAL_URL'
]
=
request
[
'ACTUAL_URL'
].
replace
(
request
[
'SERVER_URL'
],
srd
[
0
])
request
[
'ACTUAL_URL'
]
=
request
[
'ACTUAL_URL'
].
replace
(
request
[
'SERVER_URL'
],
srd
[
0
])
request
[
'SERVER_URL'
]
=
srd
[
0
]
request
[
'SERVER_URL'
]
=
srd
[
0
]
request
.
_resetURLS
()
request
.
_resetURLS
()
if
srd
[
1
]
is
not
None
:
if
srd
[
1
]
is
not
None
:
old
=
request
[
'URL'
]
old
=
request
[
'URL'
]
request
.
setVirtualRoot
(
srd
[
1
])
request
.
setVirtualRoot
(
srd
[
1
])
request
[
'ACTUAL_URL'
]
=
request
[
'ACTUAL_URL'
].
replace
(
old
,
request
[
'URL'
])
request
[
'ACTUAL_URL'
]
=
request
[
'ACTUAL_URL'
].
replace
(
old
,
request
[
'URL'
])
def
get_size
(
self
):
def
get_size
(
self
):
'''Make FTP happy'''
""" Make FTP happy
"""
return
0
return
0
def
manage_addSiteRoot
(
self
,
title
=
''
,
base
=
''
,
path
=
''
,
REQUEST
=
None
,
def
manage_addSiteRoot
(
self
,
title
=
''
,
base
=
''
,
path
=
''
,
REQUEST
=
None
,
**
ignored
):
**
ignored
):
""" """
""" Add a SiteRoot to a container.
sr
=
SiteRoot
(
title
,
base
,
path
)
"""
sr
=
SiteRoot
(
title
,
base
,
path
)
if
REQUEST
:
if
REQUEST
:
return
sr
.
manage_addToContainer
(
self
.
this
(),
return
sr
.
manage_addToContainer
(
self
.
this
(),
'%s/manage_main'
%
REQUEST
[
'URL1'
])
'%s/manage_main'
%
REQUEST
[
'URL1'
])
...
...
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