Пример #1
0
def view(request):
    available_projects = request.registry.settings['projects']
    selected_project = get_selected_project(request)

    error_id = request.matchdict['id']
    try:
        error = Error.objects().with_id(error_id)
    except:
        return HTTPNotFound()
    if request.user not in error.seenby:
        error.seenby.append(request.user)
        error.save()

    instances = ErrorInstance.objects(hash=error.hash)[:10]

    params = {
        'error': error,
        'selected_project': selected_project,
        'available_projects': available_projects,
        'instances': instances
    }

    try:
        template = 'error-view/' + str(error['language']).lower() + '.html'
        return render_to_response(template, params)
    except:
        template = 'error-view/generic.html'
        return render_to_response(template, params)
Пример #2
0
def view(request):
    project = get_selected_project(request)

    error_id = request.matchdict['id']
    try:
        error = Error.objects(project=project.token, id=error_id).get()
    except:
        return HTTPNotFound()

    error.mark_seen(request.user)
    error.save()

    instances = ErrorInstance.objects(hash=error.hash)[:10]

    params = {
        'error': error,
        'selected_project': project,
        'available_projects': Project.objects(),
        'instances': instances,
        'github': GithubLinker(project.github)
    }

    try:
        template = 'error-view/' + str(error['language']).lower() + '.html'
        return render_to_response(template, params)
    except:
        template = 'error-view/generic.html'
        return render_to_response(template, params)