示例#1
0
文件: views.py 项目: pthakkar92/wammu
def list(request, program, platform):
    if not program in [x[0] for x in PROGRAM_CHOICES]:
        raise Http404('No such program %s.' % program)
    if not platform in [x[0] for x in PLATFORM_CHOICES]:
        raise Http404('No such platform %s.' % platform)

    if platform == 'win32':
        return redirect('downloads.views.list', program=program, platform='source')

    downloads = get_current_downloads(program, platform)

    stable_release, stable_downloads = downloads[0]
    try:
        testing_release, testing_downloads = downloads[1]
    except IndexError:
        testing_release, testing_downloads = (None, None)

    if stable_downloads.count() == 0:
        raise Http404('No such download option %s/%s.' % (program, platform))

    for c in PLATFORM_CHOICES:
        if platform == c[0]:
            platform_name = c[1]

    result = render_to_response('downloads/list.html', RequestContext(request, {
        'stable_release': stable_release,
        'testing_release': testing_release,
        'stable_downloads': stable_downloads,
        'testing_downloads': testing_downloads,
        'program_include': 'downloads/programs/%s-%s.html' % (program, platform),
        'program': get_program(program),
        'program_name': program,
        'platform': platform_name,
    }))
    return result
示例#2
0
文件: views.py 项目: yeputons/website
def detail(request, program):
    if program not in (x[0] for x in PROGRAM_CHOICES):
        raise Http404("No such program %s." % program)

    downloads = get_current_downloads(program)

    stable_release, stable_downloads = downloads[0]
    try:
        testing_release, testing_downloads = downloads[1]
    except IndexError:
        testing_release, testing_downloads = (None, None)

    if stable_downloads.count() == 0:
        raise Http404("No such download option %s." % program)

    return render(
        request,
        "downloads/detail.html",
        {
            "stable_release": stable_release,
            "testing_release": testing_release,
            "stable_downloads": stable_downloads,
            "testing_downloads": testing_downloads,
            "program": get_program(program),
            "program_name": program,
        },
    )
示例#3
0
def release(request, program, version):

    release = get_object_or_404(Release, program=program, version=version)
    downloads = Download.objects.filter(release=release)

    if downloads.count() == 0:
        raise Http404('No such download option %s/%s.' % (program, version))

    return render(
        request, 'downloads/release.html', {
            'release': release,
            'downloads': downloads,
            'program': get_program(program),
            'program_name': program,
        })
示例#4
0
def release(request, program,  version):

    release = get_object_or_404(Release, program = program, version = version)
    downloads = Download.objects.filter(release = release).order_by('location')

    if downloads.count() == 0:
        raise Http404('No such download option %s/%s.' % (program, version))

    result = render(request, 'downloads/release.html', {
        'release': release,
        'downloads': downloads,
        'program': get_program(program),
        'program_name': program,
    })
    return result
示例#5
0
文件: views.py 项目: yeputons/website
def release(request, program, version):

    release = get_object_or_404(Release, program=program, version=version)
    downloads = Download.objects.filter(release=release)

    if downloads.count() == 0:
        raise Http404(f"No such download option {program}/{version}.")

    return render(
        request,
        "downloads/release.html",
        {
            "release": release,
            "downloads": downloads,
            "program": get_program(program),
            "program_name": program,
        },
    )
示例#6
0
文件: views.py 项目: pthakkar92/wammu
def program(request, program):
    if not program in [x[0] for x in PROGRAM_CHOICES]:
        raise Http404('No such program %s.' % program)
    if program in ['python-gammu']:
        raise Http404('No such program %s.' % program)

    stable_release, testing_release = get_latest_releases(program)

    downloads = get_current_downloads(program, 'source')

    return render_to_response('downloads/program.html', RequestContext(request, {
        'stable_release': stable_release,
        'testing_release': testing_release,
        'platforms': PLATFORM_CHOICES[:1],
        'downloads': downloads,
        'program': get_program(program),
        'program_name': program,
    }))
示例#7
0
def release(request, program,  version):

    release = get_object_or_404(Release, program = program, version = version)
    downloads = Download.objects.filter(release = release).order_by('location')

    if downloads.count() == 0:
        raise Http404('No such download option %s/%s.' % (program, version))

    mirror, mirrors, set_mirror, mirror_id = get_mirrors(request)

    result = render_to_response('downloads/release.html', RequestContext(request, {
        'release': release,
        'downloads': downloads,
        'program': get_program(program),
        'mirrors': mirrors,
        'mirror': mirror,
    }))
    if set_mirror:
        result.set_cookie('mirror', mirror_id, max_age = 3600 * 24 * 365)
    return result
示例#8
0
def list(request, program, platform):
    if not program in [x[0] for x in PROGRAM_CHOICES]:
        raise Http404('No such program %s.' % program)
    if not platform in [x[0] for x in PLATFORM_CHOICES]:
        raise Http404('No such platform %s.' % platform)

    downloads = get_current_downloads(program, platform)

    stable_release, stable_downloads = downloads[0]
    try:
        testing_release, testing_downloads = downloads[1]
    except IndexError:
        testing_release, testing_downloads = (None, None)

    if stable_downloads.count() == 0:
        raise Http404('No such download option %s/%s.' % (program, platform))

    mirror, mirrors, set_mirror, mirror_id = get_mirrors(request)

    for c in PLATFORM_CHOICES:
        if platform == c[0]:
            platform_name = c[1]

    result = render_to_response('downloads/list.html', RequestContext(request, {
        'stable_release': stable_release,
        'testing_release': testing_release,
        'stable_downloads': stable_downloads,
        'testing_downloads': testing_downloads,
        'program_include': 'downloads/programs/%s-%s.html' % (program, platform),
        'program': get_program(program),
        'platform': platform_name,
        'mirrors': mirrors,
        'mirror': mirror,
    }))
    if set_mirror:
        result.set_cookie('mirror', mirror_id, max_age = 3600 * 24 * 365)
    return result
示例#9
0
def detail(request, program):
    if not program in [x[0] for x in PROGRAM_CHOICES]:
        raise Http404('No such program %s.' % program)

    downloads = get_current_downloads(program)

    stable_release, stable_downloads = downloads[0]
    try:
        testing_release, testing_downloads = downloads[1]
    except IndexError:
        testing_release, testing_downloads = (None, None)

    if stable_downloads.count() == 0:
        raise Http404('No such download option %s.' % program)

    return render(
        request, 'downloads/detail.html', {
            'stable_release': stable_release,
            'testing_release': testing_release,
            'stable_downloads': stable_downloads,
            'testing_downloads': testing_downloads,
            'program': get_program(program),
            'program_name': program,
        })
示例#10
0
def detail(request, program):
    if not program in [x[0] for x in PROGRAM_CHOICES]:
        raise Http404('No such program %s.' % program)

    downloads = get_current_downloads(program)

    stable_release, stable_downloads = downloads[0]
    try:
        testing_release, testing_downloads = downloads[1]
    except IndexError:
        testing_release, testing_downloads = (None, None)

    if stable_downloads.count() == 0:
        raise Http404('No such download option %s.' % program)

    result = render(request, 'downloads/detail.html', {
        'stable_release': stable_release,
        'testing_release': testing_release,
        'stable_downloads': stable_downloads,
        'testing_downloads': testing_downloads,
        'program': get_program(program),
        'program_name': program,
    })
    return result