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
f3734c4f
Commit
f3734c4f
authored
Sep 24, 2006
by
Lennart Regebro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for #2187.
parent
d6ced29f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
27 deletions
+36
-27
doc/CHANGES.txt
doc/CHANGES.txt
+2
-0
lib/python/ZPublisher/BaseRequest.py
lib/python/ZPublisher/BaseRequest.py
+34
-27
No files found.
doc/CHANGES.txt
View file @
f3734c4f
...
@@ -10,6 +10,8 @@ Zope Changes
...
@@ -10,6 +10,8 @@ Zope Changes
- Call setDefaultSkin on new requests created as the result of
- Call setDefaultSkin on new requests created as the result of
ConflictError retries.
ConflictError retries.
- Collector #2187: PUT_factory broken
Zope 2.10.0 beta 2 (2006/09/17)
Zope 2.10.0 beta 2 (2006/09/17)
...
...
lib/python/ZPublisher/BaseRequest.py
View file @
f3734c4f
...
@@ -72,37 +72,41 @@ class DefaultPublishTraverse(object):
...
@@ -72,37 +72,41 @@ class DefaultPublishTraverse(object):
if
name
[:
1
]
==
'_'
:
if
name
[:
1
]
==
'_'
:
raise
Forbidden
(
"Object name begins with an underscore at: %s"
%
URL
)
raise
Forbidden
(
"Object name begins with an underscore at: %s"
%
URL
)
try
:
if
hasattr
(
object
,
'__bobo_traverse__'
):
if
hasattr
(
object
,
'__bobo_traverse__'
):
try
:
subobject
=
object
.
__bobo_traverse__
(
request
,
name
)
subobject
=
object
.
__bobo_traverse__
(
request
,
name
)
if
type
(
subobject
)
is
type
(())
and
len
(
subobject
)
>
1
:
if
type
(
subobject
)
is
type
(())
and
len
(
subobject
)
>
1
:
# Add additional parents into the path
# Add additional parents into the path
# XXX This needs handling. Check the publish refactor branch...
# XXX There are no tests for this:
parents
[
-
1
:]
=
list
(
subobject
[:
-
1
])
request
[
'PARENTS'
][
-
1
:]
=
list
(
subobject
[:
-
1
])
object
,
subobject
=
subobject
[
-
2
:]
object
,
subobject
=
subobject
[
-
2
:]
except
(
AttributeError
,
KeyError
,
NotFound
),
e
:
# Try to find a view
subobject
=
queryMultiAdapter
((
object
,
request
),
Interface
,
name
)
if
subobject
is
not
None
:
# OFS.Application.__bobo_traverse__ calls
# REQUEST.RESPONSE.notFoundError which sets the HTTP
# status code to 404
request
.
response
.
setStatus
(
200
)
# We don't need to do the docstring security check
# for views, so lets skip it and return the object here.
return
subobject
.
__of__
(
object
)
# No view found. Reraise the error raised by __bobo_traverse__
raise
e
else
:
# No __bobo_traverse__
# Try with an unacquired attribute:
if
hasattr
(
aq_base
(
object
),
name
):
subobject
=
getattr
(
object
,
name
)
else
:
else
:
# Try getting unacquired attributes:
# We try to fall back to a view:
if
hasattr
(
aq_base
(
object
),
name
):
subobject
=
queryMultiAdapter
((
object
,
request
),
Interface
,
name
)
subobject
=
getattr
(
object
,
name
)
if
subobject
is
not
None
:
else
:
return
subobject
.
__of__
(
object
)
subobject
=
object
[
name
]
except
(
AttributeError
,
KeyError
,
NotFound
),
e
:
# Nothing was found with __bobo_traverse__ or directly on
# the object. We try to fall back to a view:
subobject
=
queryMultiAdapter
((
object
,
request
),
Interface
,
name
)
if
subobject
is
not
None
:
# OFS.Application.__bobo_traverse__ calls
# REQUEST.RESPONSE.notFoundError which sets the HTTP
# status code to 404
request
.
response
.
setStatus
(
200
)
# We don't need to do the docstring security check
# for views, so lets skip it and return the object here.
return
subobject
.
__of__
(
object
)
# And lastly, of there is no view, try acquired attributes, but
# And lastly, of there is no view, try acquired attributes, but
# only if there is no __bobo_traverse__:
# only if there is no __bobo_traverse__:
if
not
hasattr
(
object
,
'__bobo_traverse__'
):
try
:
try
:
subobject
=
getattr
(
object
,
name
)
subobject
=
getattr
(
object
,
name
)
# Again, clear any error status created by __bobo_traverse__
# Again, clear any error status created by __bobo_traverse__
...
@@ -111,7 +115,10 @@ class DefaultPublishTraverse(object):
...
@@ -111,7 +115,10 @@ class DefaultPublishTraverse(object):
return
subobject
return
subobject
except
AttributeError
:
except
AttributeError
:
pass
pass
raise
e
# Lastly we try with key access:
subobject
=
object
[
name
]
# Ensure that the object has a docstring, or that the parent
# Ensure that the object has a docstring, or that the parent
# object has a pseudo-docstring for the object. Objects that
# object has a pseudo-docstring for the object. Objects that
...
...
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