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
c783eac2
Commit
c783eac2
authored
Apr 13, 2010
by
Wichert Akkerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge change from 2.12 branch
parent
76ac887d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
src/Zope2/App/startup.py
src/Zope2/App/startup.py
+3
-0
src/Zope2/App/tests/testExceptionHook.py
src/Zope2/App/tests/testExceptionHook.py
+7
-3
No files found.
src/Zope2/App/startup.py
View file @
c783eac2
...
@@ -24,6 +24,7 @@ from Acquisition import aq_acquire
...
@@ -24,6 +24,7 @@ from Acquisition import aq_acquire
from
Acquisition
import
aq_base
from
Acquisition
import
aq_base
from
Acquisition
import
aq_inner
from
Acquisition
import
aq_inner
from
Acquisition
import
aq_parent
from
Acquisition
import
aq_parent
from
Acquisition.interfaces
import
IAcquirer
from
App.config
import
getConfiguration
from
App.config
import
getConfiguration
from
time
import
asctime
from
time
import
asctime
from
zExceptions
import
upgradeException
from
zExceptions
import
upgradeException
...
@@ -218,6 +219,8 @@ class ZPublisherExceptionHook:
...
@@ -218,6 +219,8 @@ class ZPublisherExceptionHook:
# zope.publisher uses as well.
# zope.publisher uses as well.
view
=
queryMultiAdapter
((
v
,
REQUEST
),
name
=
u'index.html'
)
view
=
queryMultiAdapter
((
v
,
REQUEST
),
name
=
u'index.html'
)
if
view
is
not
None
:
if
view
is
not
None
:
if
IAcquirer
.
providedBy
(
published
):
view
=
view
.
__of__
(
published
)
v
=
view
()
v
=
view
()
response
=
REQUEST
.
RESPONSE
response
=
REQUEST
.
RESPONSE
response
.
setStatus
(
t
)
response
.
setStatus
(
t
)
...
...
src/Zope2/App/tests/testExceptionHook.py
View file @
c783eac2
...
@@ -16,6 +16,7 @@ import sys
...
@@ -16,6 +16,7 @@ import sys
import
unittest
import
unittest
import
logging
import
logging
import
Acquisition
from
zope.component.testing
import
PlacelessSetup
from
zope.component.testing
import
PlacelessSetup
from
zope.interface.common.interfaces
import
IException
from
zope.interface.common.interfaces
import
IException
from
zope.publisher.skinnable
import
setDefaultSkin
from
zope.publisher.skinnable
import
setDefaultSkin
...
@@ -215,7 +216,7 @@ class ExceptionHookTest(ExceptionHookTestCase):
...
@@ -215,7 +216,7 @@ class ExceptionHookTest(ExceptionHookTestCase):
self
.
call_no_exc
(
hook
,
None
,
None
,
f
)
self
.
call_no_exc
(
hook
,
None
,
None
,
f
)
self
.
assertEquals
(
hook
.
unresolved_conflict_errors
,
2
)
self
.
assertEquals
(
hook
.
unresolved_conflict_errors
,
2
)
class
Client
:
class
Client
(
Acquisition
.
Explicit
)
:
def
__init__
(
self
):
def
__init__
(
self
):
self
.
standard_error_message
=
True
self
.
standard_error_message
=
True
...
@@ -320,14 +321,16 @@ class ExceptionMessageRenderTest(ExceptionHookTestCase):
...
@@ -320,14 +321,16 @@ class ExceptionMessageRenderTest(ExceptionHookTestCase):
tb
=
client
.
messages
[
0
]
tb
=
client
.
messages
[
0
]
self
.
failUnless
(
"ConflictError: database conflict error"
in
tb
,
tb
)
self
.
failUnless
(
"ConflictError: database conflict error"
in
tb
,
tb
)
class
CustomExceptionView
:
class
CustomExceptionView
(
Acquisition
.
Explicit
)
:
def
__init__
(
self
,
context
,
request
):
def
__init__
(
self
,
context
,
request
):
self
.
context
=
context
self
.
context
=
context
self
.
request
=
request
self
.
request
=
request
def
__call__
(
self
):
def
__call__
(
self
):
return
"Exception View: %s"
%
self
.
context
.
__class__
.
__name__
return
"Exception View: %s
\
n
Context: %s"
%
(
self
.
context
.
__class__
.
__name__
,
Acquisition
.
aq_parent
(
self
).
__class__
.
__name__
)
def
registerExceptionView
(
for_
):
def
registerExceptionView
(
for_
):
from
zope.interface
import
Interface
from
zope.interface
import
Interface
...
@@ -355,6 +358,7 @@ class ExceptionViewsTest(PlacelessSetup, ExceptionHookTestCase):
...
@@ -355,6 +358,7 @@ class ExceptionViewsTest(PlacelessSetup, ExceptionHookTestCase):
self
.
failUnless
(
isinstance
(
v
,
HTTPResponse
),
v
)
self
.
failUnless
(
isinstance
(
v
,
HTTPResponse
),
v
)
self
.
failUnless
(
v
.
status
==
401
,
(
v
.
status
,
401
))
self
.
failUnless
(
v
.
status
==
401
,
(
v
.
status
,
401
))
self
.
failUnless
(
"Exception View: Unauthorized"
in
str
(
v
))
self
.
failUnless
(
"Exception View: Unauthorized"
in
str
(
v
))
self
.
failUnless
(
"Context: StandardClient"
in
str
(
v
))
def
testCustomExceptionViewForbidden
(
self
):
def
testCustomExceptionViewForbidden
(
self
):
from
ZPublisher.HTTPResponse
import
HTTPResponse
from
ZPublisher.HTTPResponse
import
HTTPResponse
...
...
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