Exemple #1
0
def error_page(request):
    project = get_selected_project(request)

    search = request.GET.get('search', '')
    show = request.GET.get('show', 'open')  # open, resolved, mine
    order_by = request.GET.get('order_by', 'date')
    direction = request.GET.get('direction', 'desc')

    if show not in ['open', 'resolved', 'mine']:
        show = 'open'

    errors = get_errors(request)

    counts = {
        'open': project.errors().active().filter().count(),
        'openUnseen': project.errors().active().filter(seenby__ne=request.user).count(),
        'resolved': project.errors().resolved().filter().count(),
        'resolvedUnseen': project.errors().resolved().filter(seenby__ne=request.user).count(),
        'mine': project.errors().active().filter(claimedby=request.user).count()
    }

    return {
        'search': search,
        'errors': errors,
        'selected_project': project,
        'available_projects': Project.objects(),
        'show': show,
        'order_by': order_by,
        'direction': direction,
        'counts': counts,
        'basename': path.basename
    }
Exemple #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)
Exemple #3
0
def admin_project(request):
    return {
        'projects': Project.objects()
    }