Example #1
0
def home(request):
    main_template = get_renderer('templates/main_template.pt').implementation()
    popular_searches = [os.path.splitext(i)[0] for i in cached_graphs()]
    return {
        'main_template': main_template,
        'popular_searches': set(popular_searches[:10]),
    }
Example #2
0
def graph(request):
    main_template = get_renderer('templates/main_template.pt').implementation()
    package = request.params.get('package')
    package_filename = '.'.join((package, 'png'))
    cached = cached_graphs()
    if not package_filename in cached:
        try:
            generete_graph(package)
        except DistributionNotFound:
            raise HTTPFound(location='/package_not_found?package=%s' % package)
    popular_searches = [os.path.splitext(i)[0] for i in cached]
    template_vars = {'graph_path': '/graphs/%s' % package_filename,}
    template_vars.update(home(request))
    return template_vars
Example #3
0
def graph(request):
    main_template = get_renderer('templates/main_template.pt').implementation()
    package = request.params.get('package')
    package_filename = '.'.join((package, 'png'))
    cached = cached_graphs()
    if not package_filename in cached:
        try:
            generete_graph(package)
        except DistributionNotFound:
            raise HTTPFound(location='/package_not_found?package=%s' % package)
    popular_searches = [os.path.splitext(i)[0] for i in cached]
    template_vars = {
        'graph_path': '/graphs/%s' % package_filename,
    }
    template_vars.update(home(request))
    return template_vars
Example #4
0
def home(request):
    main_template = get_renderer('templates/main_template.pt').implementation()
    popular_searches = [os.path.splitext(i)[0] for i in cached_graphs()]
    return {'main_template': main_template,
            'popular_searches': set(popular_searches[:10]),
            }