From 57a28d72e7d491889292fc88a4e3ee1bced2c38f Mon Sep 17 00:00:00 2001
From: Greg Price
Date: Fri, 13 Jun 2008 03:51:37 -0400
Subject: [PATCH] all details in email too, still just for CodeError
svn path=/trunk/packages/sipb-xen-www/; revision=601
---
code/main.py | 7 ++++---
code/templates/__init__.py | 2 +-
code/templates/error.tmpl | 16 ++--------------
code/templates/error_raw.tmpl | 13 +++++++++++++
4 files changed, 20 insertions(+), 18 deletions(-)
create mode 100644 code/templates/error_raw.tmpl
diff --git a/code/main.py b/code/main.py
index 01d6e39..dd6b867 100755
--- a/code/main.py
+++ b/code/main.py
@@ -119,11 +119,12 @@ DEFAULT_HEADERS = {'Content-Type': 'text/html'}
def error(op, username, fields, err, emsg, traceback):
"""Print an error page when a CodeError occurs"""
- send_error_mail('xvm error on %s for %s: %s' % (op, username, err),
- 'error on %s for %s: %s\n\n%s\n'
- % (op, username, err, emsg))
d = dict(op=op, user=username, fields=fields,
errorMessage=str(err), stderr=emsg, traceback=traceback)
+ details = templates.error_raw(searchList=[d])
+ send_error_mail('xvm error on %s for %s: %s' % (op, username, err),
+ details)
+ d['details'] = details
return templates.error(searchList=[d])
def invalidInput(op, username, fields, err, emsg):
diff --git a/code/templates/__init__.py b/code/templates/__init__.py
index d26672f..b2b23da 100644
--- a/code/templates/__init__.py
+++ b/code/templates/__init__.py
@@ -1,4 +1,4 @@
-__all__ = 'info command error help invalid list unauth vnc'.split()
+__all__ = 'info command error error_raw help invalid list unauth vnc'.split()
for _name in __all__:
try:
_module = __import__(_name, globals(), {}, [_name])
diff --git a/code/templates/error.tmpl b/code/templates/error.tmpl
index b11deaa..ff9b4e0 100644
--- a/code/templates/error.tmpl
+++ b/code/templates/error.tmpl
@@ -12,21 +12,9 @@ mail about it.
Feel free to poke us at xvm@mit.edu if this bug is
consistently biting you and we don't seem to be fixing it.
-In case you're curious, the gory details are here.
+In case you're curious, the gory details are below.
-Error on operation $op for user $user: $errorMessage
-
-Fields:
-#for $f in $fields:
-$f=$fields[$f].value
-#end for
-
-Error output:
-$stderr#slurp
----- end error output
-
-Traceback:
-$traceback
+$details
#end def
diff --git a/code/templates/error_raw.tmpl b/code/templates/error_raw.tmpl
new file mode 100644
index 0000000..bd4db84
--- /dev/null
+++ b/code/templates/error_raw.tmpl
@@ -0,0 +1,13 @@
+Error on operation $op for user $user: $errorMessage
+
+Fields:
+#for $f in $fields:
+$f=$fields[$f].value
+#end for
+
+Error output:
+$stderr#slurp
+---- end error output
+
+Traceback:
+$traceback
--
1.7.9.5