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
690a26c9
Commit
690a26c9
authored
Apr 18, 1997
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Brian's changes to try and get file name and line no in exceptions.
parent
16d4c6ca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
10 deletions
+26
-10
lib/python/ZPublisher/Client.py
lib/python/ZPublisher/Client.py
+16
-8
lib/python/ZPublisher/Response.py
lib/python/ZPublisher/Response.py
+10
-2
No files found.
lib/python/ZPublisher/Client.py
View file @
690a26c9
"""Bobo call interface"""
__version__
=
'$Revision: 1.
6
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
7
$'
[
11
:
-
2
]
import
sys
,
regex
from
httplib
import
HTTP
...
...
@@ -74,12 +74,14 @@ exceptmap ={'AccessError' :AccessError,
class RemoteException:
def __init__(self,etype=None,evalue=None,
url=None,query
=None,
http_code=None,
http_msg=None, http_resp=None):
def __init__(self,etype=None,evalue=None,
efile=None,eline=None,url
=None,
query=None,http_code=None,
http_msg=None, http_resp=None):
"""Contains information about an exception which
occurs in a remote method call"""
self.exc_type =etype
self.exc_value =evalue
self.exc_file =efile
self.exc_line =eline
self.url =url
self.query =query
self.http_code =http_code
...
...
@@ -87,8 +89,9 @@ class RemoteException:
self.response =http_resp
def __repr__(self):
return '
%
s
\
n
%
s
%
s
for
%
s
' % (self.exc_value,self.http_code,
self.http_message,self.url)
return '
%
s
(
File
:
%
s
Line
:
%
s
)
\
n
%
s
%
s
for
%
s
' % (
self.exc_value,self.exc_file,self.exc_line,
self.http_code,self.http_message,self.url)
...
...
@@ -151,12 +154,17 @@ class RemoteMethod:
else:
try: v=headers.dict['
bobo
-
exception
-
value
']
except: v=ec
try: f=headers.dict['
bobo
-
exception
-
file
']
except: f='
Unknown
'
try: l=headers.dict['
bobo
-
exception
-
line
']
except: l='
Unknown
'
try: t=exceptmap[headers.dict['
bobo
-
exception
-
type
']]
except:
if ec >= 400 and ec < 500: t=NotFound
elif ec >= 500 and ec < 600: t=ServerError
else: t=NotAvailable
raise t, RemoteException(t,v,self.url,query,ec,em,response)
raise t, RemoteException(t,v,f,l,self.url,query,ec,em,response)
...
...
@@ -245,8 +253,8 @@ if __name__ == "__main__": main()
#
# $Log: Client.py,v $
# Revision 1.
6 1997/04/18 16:41:36
jim
#
Machine name printed in NotFound
# Revision 1.
7 1997/04/18 19:45:47
jim
#
Brian'
s
changes
to
try
and
get
file
name
and
line
no
in
exceptions
.
#
# Revision 1.5 1997/04/16 21:56:27 jim
# repr now shows URL on Not Found.
...
...
lib/python/ZPublisher/Response.py
View file @
690a26c9
...
...
@@ -3,7 +3,7 @@
__doc__
=
'''CGI Response Output formatter
$Id: Response.py,v 1.1
4 1997/04/12 17:17:32
jim Exp $'''
$Id: Response.py,v 1.1
5 1997/04/18 19:46:19
jim Exp $'''
# Copyright
#
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
...
...
@@ -55,6 +55,9 @@ $Id: Response.py,v 1.14 1997/04/12 17:17:32 jim Exp $'''
# (540) 371-6909
#
# $Log: Response.py,v $
# Revision 1.15 1997/04/18 19:46:19 jim
# Brian's changes to try and get file name and line no in exceptions.
#
# Revision 1.14 1997/04/12 17:17:32 jim
# Brian added loggic to set bobo-specific headers to transmit exception
# info.
...
...
@@ -119,7 +122,7 @@ $Id: Response.py,v 1.14 1997/04/12 17:17:32 jim Exp $'''
#
#
#
__version__
=
'$Revision: 1.1
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
5
$'
[
11
:
-
2
]
import
string
,
types
,
sys
,
regex
,
regsub
...
...
@@ -482,9 +485,14 @@ class Response:
# Try to capture exception info for bci calls
et
=
regsub
.
gsub
(
'
\
n
'
,
'
\
t
\
n
'
,
str
(
t
))
ev
=
regsub
.
gsub
(
'
\
n
'
,
'
\
t
\
n
'
,
str
(
v
))
el
=
str
(
tb
.
tb_lineno
)
ef
=
str
(
tb
.
tb_frame
.
f_code
.
co_filename
)
if
string
.
find
(
ev
,
'<html>'
)
>=
0
:
ev
=
'bobo exception'
self
.
setHeader
(
'bobo-exception-type'
,
et
)
self
.
setHeader
(
'bobo-exception-value'
,
ev
)
self
.
setHeader
(
'bobo-exception-file'
,
ef
)
self
.
setHeader
(
'bobo-exception-line'
,
el
)
except
:
# Dont try so hard that we cause other problems ;)
pass
...
...
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