1
2
3
4
5
6
7
8
9
10
11 import os
12 import re
13 import cgitb
14 from cStringIO import StringIO
15 import Globals
16 from Products.ZenUtils.Utils import unused, zenPath
17
18 unused(Globals)
19
20 pattern = re.compile(r'<p> (?P<message>.* contains the description of this error.)')
21
23 file_ = StringIO()
24 hook = cgitb.Hook(display=0, logdir=zenPath('log', 'tracebacks'), file=file_, format='text')
25 os.makedirs(hook.logdir)
26 hook.handle(exc_info)
27 output = file_.getvalue()
28 match = pattern.search(output)
29 return match.group('message')
30