Customizing cgitb

  • Thread starter D'Arcy J.M. Cain
  • Start date
D

D'Arcy J.M. Cain

I have a small problem with the cgitb module. I know that I can
basically write my own version but it seems kind of silly to rewrite
something that does 99% what I want. Here is an excerpt from the
output of an exception.

1520 (current_job['job_id'], job['_SELECT_']))
1521
1522 elif job['_ACTION_'].startswith('queue_'):
1523 action = job['_ACTION_'][6:]
1524 if action == 'mod':
job = {'_PARENTDIR_': '', '__BAD_DATA__': [], '_REMOTE...orage('npq7',
'5')]), '_REMOTE_HOST_': 'unknown'} ].startswith undefined

My problem is that the "job =" line is abridging the value. I need to
see all of the variables in the dictionary. Is there any way I can
wrap cgitb and get the behaviour I want or do I have to write my own
method for sys.excepthook?
 
P

Peter Otten

D'Arcy J.M. Cain said:
I have a small problem with the cgitb module. I know that I can
basically write my own version but it seems kind of silly to rewrite
something that does 99% what I want. Here is an excerpt from the
output of an exception.

1520 (current_job['job_id'], job['_SELECT_']))
1521
1522 elif job['_ACTION_'].startswith('queue_'):
1523 action = job['_ACTION_'][6:]
1524 if action == 'mod':
job = {'_PARENTDIR_': '', '__BAD_DATA__': [], '_REMOTE...orage('npq7',
'5')]), '_REMOTE_HOST_': 'unknown'} ].startswith undefined

My problem is that the "job =" line is abridging the value. I need to
see all of the variables in the dictionary. Is there any way I can
wrap cgitb and get the behaviour I want or do I have to write my own
method for sys.excepthook?

You could try to monkey-patch pydoc:

import pydoc
def cram(text, maxlen):
return text
pydoc.cram = cram

Peter
 
D

D'Arcy J.M. Cain

You could try to monkey-patch pydoc:

I suppose so. Not a comfortable solution of course. It's bad enough
when you get too familiar with the internals of a module but even worse
when you need to get familiar with the internals of modules imported by
a module. I'll give it a shot though.
import pydoc
def cram(text, maxlen):
return text
pydoc.cram = cram

Or...

import pydoc
pydoc.cram = lambda text,maxlen: text

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top