Esempio n. 1
0
def group(request, group_id):
    group = get_object_or_404(GroupedMessage, pk=group_id)

    try:
        obj = group.message_set.all().order_by('-id')[0]
    except IndexError:
        # It's possible that a message would not be created under certain circumstances
        # (such as a post_save signal failing)
        obj = Message(group=group, data=group.data)

    # template information
    template_info = None
    # exception information
    exc_type, exc_value = None, None
    # stack frames
    frames = None
    # module versions
    version_data = None
    user_data = None

    if '__sentry__' in obj.data:
        sentry_data = obj.data['__sentry__']
        if 'exc' in sentry_data:
            module, args, frames = sentry_data['exc']
        elif 'exception' in sentry_data:
            module, args = sentry_data['exception']
        else:
            module, args = None, None
        
        if 'frames' in sentry_data:
            frames = sentry_data['frames']

        if 'user' in sentry_data:
            user_data = sentry_data['user']

        if module and args:
            # We fake the exception class due to many issues with imports/builtins/etc
            exc_type = type(str(obj.class_name), (Exception,), {})
            exc_value = exc_type(obj.message)
            exc_value.args = args

        if 'template' in sentry_data:
            template_info = get_template_info(sentry_data['template'], exc_value)
    
        if 'versions' in sentry_data:
            version_data = sentry_data['versions'].iteritems()

    return render_to_response('sentry/group/details.html', {
        'page': 'details',
        'group': group,
        'json_data': iter_data(obj),
        'user_data': user_data,
        'version_data': version_data,
        'frames': frames,
        'template_info': template_info,
        'request': request,
    })
Esempio n. 2
0
def group_message_details(request, group_id, message_id):
    group = get_object_or_404(GroupedMessage, pk=group_id)

    message = get_object_or_404(group.message_set, pk=message_id)

    # template information
    template_info = None
    # exception information
    exc_type, exc_value = None, None
    # stack frames
    frames = None
    user_data = None
    
    if '__sentry__' in message.data:
        sentry_data = message.data['__sentry__']
        if 'exc' in sentry_data:
            module, args, frames = sentry_data['exc']
        elif 'exception' in sentry_data:
            module, args = sentry_data['exception']
        else:
            module, args = None, None
        
        if 'frames' in sentry_data:
            frames = sentry_data['frames']

        if 'user' in sentry_data:
            user_data = sentry_data['user']

        if module and args:
            # We fake the exception class due to many issues with imports/builtins/etc
            exc_type = type(str(message.class_name), (Exception,), {})
            exc_value = exc_type(message.message)
            exc_value.args = args

        if 'template' in sentry_data:
            template_info = get_template_info(sentry_data['template'], exc_value)
    
    return render_to_response('sentry/group/message.html', {
        'page': 'messages',
        'group': group,
        'message': message,
        'json_data': iter_data(message),
        'user_data': user_data,
        'frames': frames,
        'template_info': template_info,
        'request': request,
    })
Esempio n. 3
0
def group_message_details(request, group_id, message_id):
    group = get_object_or_404(GroupedMessage, pk=group_id)

    message = get_object_or_404(group.message_set, pk=message_id)

    # template information
    template_info = None
    # exception information
    exc_type, exc_value = None, None
    # stack frames
    frames = None
    lastframe = None
    # module versions
    version_data = None
    user_data = None

    if '__sentry__' in message.data:
        sentry_data = message.data['__sentry__']
        if 'exc' in sentry_data:
            module, args, frames = sentry_data['exc']
        elif 'exception' in sentry_data:
            module, args = sentry_data['exception']
        else:
            module, args = None, None

        if 'frames' in sentry_data:
            frames = sentry_data['frames']

        if 'user' in sentry_data:
            user_data = sentry_data['user']

        if module and args:
            # We fake the exception class due to many issues with imports/builtins/etc
            exc_type = message.class_name
            exc_value = type(str(message.class_name), (Exception, ),
                             {})(message.message)
            exc_value.args = args

        if 'template' in sentry_data:
            template_info = get_template_info(sentry_data['template'],
                                              exc_value)

        if 'versions' in sentry_data:
            version_data = sorted(sentry_data['versions'].iteritems())

    if frames:
        lastframe = frames[-1]
    else:
        lastframe = None

    return render_to_response(
        'sentry/group/message.html', {
            'page': 'messages',
            'group': group,
            'message': message,
            'json_data': iter_data(message),
            'user_data': user_data,
            'version_data': version_data,
            'frames': frames,
            'lastframe': lastframe,
            'template_info': template_info,
            'exception_type': exc_type,
            'exception_value': exc_value,
            'request': request,
        })
Esempio n. 4
0
def group(request, group_id):
    group = get_object_or_404(GroupedMessage, pk=group_id)

    try:
        obj = group.message_set.all().order_by('-id')[0]
    except IndexError:
        # It's possible that a message would not be created under certain circumstances
        # (such as a post_save signal failing)
        obj = Message(group=group, data=group.data)

    # template information
    template_info = None
    # exception information
    exc_type, exc_value = None, None
    # stack frames
    frames = None
    # module versions
    version_data = None
    user_data = None

    if '__sentry__' in obj.data:
        sentry_data = obj.data['__sentry__']
        if 'exc' in sentry_data:
            module, args, frames = sentry_data['exc']
        elif 'exception' in sentry_data:
            module, args = sentry_data['exception']
        else:
            module, args = None, None

        if 'frames' in sentry_data:
            frames = sentry_data['frames']

        if 'user' in sentry_data:
            user_data = sentry_data['user']

        if module and args:
            # We fake the exception class due to many issues with imports/builtins/etc
            exc_type = obj.class_name
            exc_value = type(str(obj.class_name), (Exception, ),
                             {})(obj.message)
            exc_value.args = args

        if 'template' in sentry_data:
            template_info = get_template_info(sentry_data['template'],
                                              exc_value)

        if 'versions' in sentry_data:
            version_data = sorted(sentry_data['versions'].iteritems())

    if frames:
        lastframe = frames[-1]
    else:
        lastframe = None

    return render_to_response(
        'sentry/group/details.html', {
            'page': 'details',
            'group': group,
            'json_data': iter_data(obj),
            'user_data': user_data,
            'version_data': version_data,
            'frames': frames,
            'lastframe': lastframe,
            'template_info': template_info,
            'exception_type': exc_type,
            'exception_value': exc_value,
            'request': request,
        })