Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Static Public Attributes | Properties
MoinMoin.support.werkzeug.debug.tbtools.Traceback Class Reference

List of all members.

Public Member Functions

def __init__
def filter_hidden_frames
def is_syntax_error
def exception
def log
def paste
def render_summary
def render_full
def plaintext

Public Attributes

 exc_type
 exc_value
 exception_type
 frames

Static Public Attributes

tuple plaintext = cached_property(plaintext)

Properties

 is_syntax_error = property(is_syntax_error)
 exception = property(exception)
 id = property(lambda x: id(x))

Detailed Description

Wraps a traceback.

Definition at line 74 of file tbtools.py.


Constructor & Destructor Documentation

def MoinMoin.support.werkzeug.debug.tbtools.Traceback.__init__ (   self,
  exc_type,
  exc_value,
  tb 
)

Definition at line 77 of file tbtools.py.

00077 
00078     def __init__(self, exc_type, exc_value, tb):
00079         self.exc_type = exc_type
00080         self.exc_value = exc_value
00081         if not isinstance(exc_type, str):
00082             exception_type = exc_type.__name__
00083             if exc_type.__module__ not in ('__builtin__', 'exceptions'):
00084                 exception_type = exc_type.__module__ + '.' + exception_type
00085         else:
00086             exception_type = exc_type
00087         self.exception_type = exception_type
00088 
00089         # we only add frames to the list that are not hidden.  This follows
00090         # the the magic variables as defined by paste.exceptions.collector
00091         self.frames = []
00092         while tb:
00093             self.frames.append(Frame(exc_type, exc_value, tb))
00094             tb = tb.tb_next


Member Function Documentation

String representation of the exception.

Definition at line 127 of file tbtools.py.

00127 
00128     def exception(self):
00129         """String representation of the exception."""
00130         buf = traceback.format_exception_only(self.exc_type, self.exc_value)
        return ''.join(buf).strip().decode('utf-8', 'replace')
Remove the frames according to the paste spec.

Definition at line 95 of file tbtools.py.

00095 
00096     def filter_hidden_frames(self):
00097         """Remove the frames according to the paste spec."""
00098         new_frames = []
00099         hidden = False
00100         for frame in self.frames:
00101             hide = frame.hide
00102             if hide in ('before', 'before_and_this'):
00103                 new_frames = []
00104                 hidden = False
00105                 if hide == 'before_and_this':
00106                     continue
00107             elif hide in ('reset', 'reset_and_this'):
00108                 hidden = False
00109                 if hide == 'reset_and_this':
00110                     continue
00111             elif hide in ('after', 'after_and_this'):
00112                 hidden = True
00113                 if hide == 'after_and_this':
00114                     continue
00115             elif hide or hidden:
00116                 continue
00117             new_frames.append(frame)
00118 
00119         # if the last frame is missing something went terrible wrong :(
00120         if self.frames[-1] in new_frames:
00121             self.frames[:] = new_frames

Is it a syntax error?

Definition at line 122 of file tbtools.py.

00122 
00123     def is_syntax_error(self):
00124         """Is it a syntax error?"""
        return isinstance(self.exc_value, SyntaxError)
def MoinMoin.support.werkzeug.debug.tbtools.Traceback.log (   self,
  logfile = None 
)
Log the ASCII traceback into a file object.

Definition at line 133 of file tbtools.py.

00133 
00134     def log(self, logfile=None):
00135         """Log the ASCII traceback into a file object."""
00136         if logfile is None:
00137             logfile = sys.stderr
00138         tb = self.plaintext.encode('utf-8', 'replace').rstrip() + '\n'
00139         logfile.write(tb)

Here is the caller graph for this function:

Create a paste and return the paste id.

Definition at line 140 of file tbtools.py.

00140 
00141     def paste(self):
00142         """Create a paste and return the paste id."""
00143         from xmlrpclib import ServerProxy
00144         srv = ServerProxy('http://paste.pocoo.org/xmlrpc/')
00145         return srv.pastes.newPaste('pytb', self.plaintext)

Definition at line 156 of file tbtools.py.

00156 
00157     def plaintext(self):
        return render_template('traceback_plaintext.html', traceback=self)

Here is the call graph for this function:

Render the Full HTML page with the traceback info.

Definition at line 151 of file tbtools.py.

00151 
00152     def render_full(self, evalex=False):
00153         """Render the Full HTML page with the traceback info."""
00154         return render_template('traceback_full.html', traceback=self,
00155                                evalex=evalex)

Here is the call graph for this function:

def MoinMoin.support.werkzeug.debug.tbtools.Traceback.render_summary (   self,
  include_title = True 
)
Render the traceback for the interactive console.

Definition at line 146 of file tbtools.py.

00146 
00147     def render_summary(self, include_title=True):
00148         """Render the traceback for the interactive console."""
00149         return render_template('traceback_summary.html', traceback=self,
00150                                include_title=include_title)

Here is the call graph for this function:


Member Data Documentation

Definition at line 78 of file tbtools.py.

Definition at line 79 of file tbtools.py.

Definition at line 86 of file tbtools.py.

Definition at line 90 of file tbtools.py.

Definition at line 158 of file tbtools.py.


Property Documentation

Definition at line 131 of file tbtools.py.

MoinMoin.support.werkzeug.debug.tbtools.Traceback.id = property(lambda x: id(x)) [static]

Definition at line 160 of file tbtools.py.

Definition at line 125 of file tbtools.py.


The documentation for this class was generated from the following file: