103 """returns a title according to the result set - used for the |
103 """returns a title according to the result set - used for the |
104 title in the HTML header |
104 title in the HTML header |
105 """ |
105 """ |
106 return self._cw._('an error occurred') |
106 return self._cw._('an error occurred') |
107 |
107 |
|
108 def _excinfo(self): |
|
109 req = self._cw |
|
110 ex = req.data.get('ex') |
|
111 excinfo = req.data.get('excinfo') |
|
112 if 'errmsg' in req.data: |
|
113 errmsg = req.data['errmsg'] |
|
114 exclass = None |
|
115 else: |
|
116 errmsg = exc_message(ex, req.encoding) |
|
117 exclass = ex.__class__.__name__ |
|
118 return errmsg, exclass, excinfo |
|
119 |
108 def call(self): |
120 def call(self): |
109 req = self._cw.reset_headers() |
121 req = self._cw.reset_headers() |
110 w = self.w |
122 w = self.w |
111 ex = req.data.get('ex')#_("unable to find exception information")) |
|
112 excinfo = req.data.get('excinfo') |
|
113 title = self._cw._('an error occurred') |
123 title = self._cw._('an error occurred') |
114 w(u'<h2>%s</h2>' % title) |
124 w(u'<h2>%s</h2>' % title) |
115 if 'errmsg' in req.data: |
125 ex, exclass, excinfo = self._excinfo() |
116 ex = req.data['errmsg'] |
|
117 exclass = None |
|
118 else: |
|
119 exclass = ex.__class__.__name__ |
|
120 ex = exc_message(ex, req.encoding) |
|
121 if excinfo is not None and self._cw.vreg.config['print-traceback']: |
126 if excinfo is not None and self._cw.vreg.config['print-traceback']: |
122 if exclass is None: |
127 if exclass is None: |
123 w(u'<div class="tb">%s</div>' |
128 w(u'<div class="tb">%s</div>' |
124 % xml_escape(ex).replace("\n","<br />")) |
129 % xml_escape(ex).replace("\n","<br />")) |
125 else: |
130 else: |