def show_command(request, command):
    "show an individual command, along with the last few runs"

    # throw a 404 if we don't find anything
    existing_command = get_object_or_404(Command, slug__iexact=command)
    
    # get all runs
    runs = Run.objects.filter(command=existing_command)
    
    paginator = Paginator(runs, 10) # Show 10 runs per page

    # Make sure page request is an int. If not, deliver first page.
    try:
        page = int(request.GET.get('page', '1'))
    except __HOLE__:
        page = 1

    # If page request (9999) is out of range, deliver last page of results.
    try:
        run_list = paginator.page(page)
    except (EmptyPage, InvalidPage):
        run_list = paginator.page(paginator.num_pages)
    
    context = {
        'command': existing_command,
        'runs': run_list,
    }
    return render_to_response('show_command.html', context,
        context_instance=RequestContext(request))
dataset/ETHPy150Open garethr/Asteroid/asteroid/apps/runner/views.py/show_command