Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Georgios Dagkakis
erp5
Commits
1c451d99
Commit
1c451d99
authored
Jan 22, 2014
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zExceptions: Monkey patch for Zope to display source code in Zope Exceptions tracebacks.
parent
c2ce3ba0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
0 deletions
+52
-0
product/ERP5Type/ZopePatch.py
product/ERP5Type/ZopePatch.py
+1
-0
product/ERP5Type/patches/ExceptionFormatter.py
product/ERP5Type/patches/ExceptionFormatter.py
+51
-0
No files found.
product/ERP5Type/ZopePatch.py
View file @
1c451d99
...
...
@@ -78,6 +78,7 @@ from Products.ERP5Type.patches import DCWorkflowGraph
from
Products.ERP5Type.patches
import
AceEditorZMI
from
Products.ERP5Type.patches
import
CachingPolicyManager
from
Products.ERP5Type.patches
import
AcceleratedHTTPCacheManager
from
Products.ERP5Type.patches
import
ExceptionFormatter
# These symbols are required for backward compatibility
from
Products.ERP5Type.patches.PropertyManager
import
ERP5PropertyManager
...
...
product/ERP5Type/patches/ExceptionFormatter.py
0 → 100644
View file @
1c451d99
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2014 Arnaud Fontaine <arnaud.fontaine@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from
zExceptions.ExceptionFormatter
import
TextExceptionFormatter
TextExceptionFormatter_formatLine
=
TextExceptionFormatter
.
formatLine
def
formatLine
(
self
,
tb
,
*
args
,
**
kwargs
):
"""
Monkey patched to display source code lines when an Exception traceback is
displayed in Zope
"""
f
=
tb
.
tb_frame
filename
=
f
.
f_code
.
co_filename
lineno
=
tb
.
tb_lineno
f_globals
=
f
.
f_globals
line_str
=
TextExceptionFormatter_formatLine
(
self
,
tb
,
*
args
,
**
kwargs
)
try
:
import
linecache
source_code_line
=
linecache
.
getline
(
filename
,
lineno
,
f_globals
)
line_str
+=
self
.
line_sep
+
' '
+
self
.
escape
(
source_code_line
.
strip
())
except
Exception
:
pass
return
line_str
TextExceptionFormatter
.
formatLine
=
formatLine
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