def _callFUT(self, as_html=False):
     from zope.exceptions.exceptionformatter import extract_stack
     f = sys.exc_info()[2].tb_frame
     try:
         return ''.join(extract_stack(f, as_html=as_html))
     finally:
         del f
 def test_noinput(self):
     try:
         raise ExceptionForTesting
     except ExceptionForTesting:
         from zope.exceptions.exceptionformatter import extract_stack
         s = ''.join(extract_stack())
         self.assertTrue(s.find('test_noinput') >= 0)
 def test_noinput(self):
     try:
         raise ExceptionForTesting
     except ExceptionForTesting:
         from zope.exceptions.exceptionformatter import extract_stack
         s = ''.join(extract_stack())
         self.assertTrue(s.find('test_noinput') >= 0)
 def _callFUT(self, as_html=False):
     from zope.exceptions.exceptionformatter import extract_stack
     f = sys.exc_info()[2].tb_frame
     try:
         return ''.join(extract_stack(f, as_html=as_html))
     finally:
         del f
Esempio n. 5
0
 def _collect_traceback(self):
     try:
         raise ValueError('boom')
     except:
         # we need here exceptionformatter, otherwise __traceback_info__
         # is not added
         stack = exceptionformatter.extract_stack(
             sys.exc_info()[2].tb_frame.f_back, limit=TB_LIMIT)
         tb = ''.join(stack[:-2])
         return tb
Esempio n. 6
0
 def _collect_traceback(self):
     try:
         raise ValueError('boom')
     except:
         # we need here exceptionformatter, otherwise __traceback_info__
         # is not added
         stack = exceptionformatter.extract_stack(
             sys.exc_info()[2].tb_frame.f_back, limit=TB_LIMIT)
         tb = ''.join(stack[:-2])
         return tb
Esempio n. 7
0
    def __call__(self, *args, **kwargs):
        if self.ADD_TB:
            try:
                raise ValueError('boom')
            except:
                # we need here exceptionformatter, otherwise __traceback_info__
                # is not added
                tb = ''.join(exceptionformatter.extract_stack(
                    sys.exc_info()[2].tb_frame.f_back, limit=self.TB_LIMIT))
        else:
            tb = '  <omitted>'

        txn = transaction.get()
        txn = '%i - %s' % (id(txn), txn.description),

        COLLECTION_LOG.debug(
            "collection: %s.%s %s,\n TXN:%s,\n args:%r,\n kwargs:%r, \n tb:\n%s",
            self.collection.database.name, self.collection.name,
            self.function.__name__, txn, args, kwargs, tb)

        return self.function(*args, **kwargs)
Esempio n. 8
0
    def __call__(self, *args, **kwargs):
        if self.ADD_TB:
            try:
                raise ValueError('boom')
            except:
                # we need here exceptionformatter, otherwise __traceback_info__
                # is not added
                tb = ''.join(
                    exceptionformatter.extract_stack(
                        sys.exc_info()[2].tb_frame.f_back,
                        limit=self.TB_LIMIT))
        else:
            tb = '  <omitted>'

        txn = transaction.get()
        txn = '%i - %s' % (id(txn), txn.description),

        COLLECTION_LOG.debug(
            "collection: %s.%s %s,\n TXN:%s,\n args:%r,\n kwargs:%r, \n tb:\n%s",
            self.collection.database.name, self.collection.name,
            self.function.__name__, txn, args, kwargs, tb)

        return self.function(*args, **kwargs)
Esempio n. 9
0
def st(as_html=0):
    f = sys.exc_info()[2].tb_frame
    try:
        return ''.join(extract_stack(f, as_html=as_html))
    finally:
        del f