def to_dict(self, *a, **kw):
        ret = super(ContextualInternalServerError, self).to_dict(*a, **kw)
        del ret['exc_info']
        exc_info = getattr(self, 'exc_info', None)
        if not exc_info:
            return ret
        exc_tb = exc_info.tb_info.to_dict()
        for i, frame in enumerate(exc_tb['frames']):
            if self.hide_internal_frames:
                if not frame['line'] and frame['module_path'] == '<string>':
                    frame['is_hidden'] = True
                elif frame['module_name'] == 'clastic.sinter' and \
                     frame['func_name'] == 'inject':
                    frame['is_hidden'] = True
            frame['id'] = i
            try:
                pre_start_lineno = frame['pre_lines'][0]['lineno']
            except __HOLE__:
                pre_start_lineno = 1
            frame['pre_start_lineno'] = pre_start_lineno
            frame['post_start_lineno'] = frame['lineno'] + 1
        try:
            last_frame = exc_tb['frames'][-1]
        except:
            last_frame = None

        eid = {'is_email': False,
               'clastic_version_info': '0.4.1dev',  # TODO
               'exc_type': exc_info.exc_type,
               'exc_value': exc_info.exc_msg,
               'exc_tb': exc_tb,
               'last_frame': last_frame,
               'exc_tb_str': str(exc_info.tb_info),
               'server_time': str(datetime.datetime.now()),
               'server_time_utc': str(datetime.datetime.utcnow()),
               'python': {'executable': sys.executable,
                          'version': sys.version.replace('\n', ' '),
                          'path': sys.path}}
        request = self.request
        if request:
            eid['req'] = {'path': request.path,
                          'full_url': request.url,
                          'method': request.method,
                          'abs_path': request.path,
                          'url_params': request.args,
                          'cookies': request.cookies,
                          'headers': request.headers,
                          'files': request.files}
        ret.update(eid)
        return ret
dataset/ETHPy150Open mahmoud/clastic/clastic/errors.py/ContextualInternalServerError.to_dict