예제 #1
0
파일: views.py 프로젝트: pthakkar92/wammu
def download(request):
    downloads = get_current_downloads('gammu', 'source')
    downloads += get_current_downloads('wammu', 'source')

    return render_to_response('downloads/index.html', RequestContext(request, {
        'downloads': downloads,
        'platforms': PLATFORM_CHOICES[:1],
    }))
예제 #2
0
파일: views.py 프로젝트: juanjosezg/website
def download(request):
    mirror, mirrors, set_mirror, mirror_id = get_mirrors(request)

    downloads = get_current_downloads('gammu', 'source')
    downloads += get_current_downloads('wammu', 'source')

    return render_to_response('downloads/index.html', RequestContext(request, {
        'mirrors': mirrors,
        'mirror': mirror,
        'downloads': downloads,
        'platforms': PLATFORM_CHOICES,
    }))
예제 #3
0
파일: views.py 프로젝트: juanjosezg/website
def index(request):
    mirror, mirrors, set_mirror, mirror_id = get_mirrors(request)

    downloads = get_current_downloads('gammu', 'source')
    downloads += get_current_downloads('wammu', 'source')

    news = Entry.objects.order_by('-pub_date')[:settings.NEWS_ON_MAIN_PAGE]
    screenshot = Screenshot.objects.filter(featured = True).order_by('?')[0]
    phones = Phone.objects.filter(state__in = ['approved', 'draft']).order_by('-created')[:settings.PHONES_ON_MAIN_PAGE]
    return render_to_response('index.html', RequestContext(request, {
        'news': news,
        'screenshot': screenshot,
        'downloads': downloads,
        'mirror': mirror,
        'phones': phones,
    }))
예제 #4
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,
        },
    )
예제 #5
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
예제 #6
0
파일: views.py 프로젝트: yeputons/website
def pad(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)

    release = downloads[0][0]
    try:
        download = downloads[0][1].filter(location__iendswith="setup.exe")[0]
    except IndexError:
        try:
            download = downloads[0][1].filter(
                location__iendswith="windows.exe")[0]
        except IndexError:
            download = downloads[0][1].filter(location__iendswith=".zip")[0]

    return render(
        request,
        "downloads/pad/%s.xml" % program,
        {
            "download": download,
            "release": release,
        },
        content_type="application/xml",
    )
예제 #7
0
def doap(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)

    return render(request, 'downloads/doap/%s.xml' % program, {
        'downloads': downloads[0][1],
        'release': downloads[0][0],
    }, content_type = 'application/xml')
예제 #8
0
def doap(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)

    return render(request, 'downloads/doap/%s.xml' % program, {
        'downloads': downloads[0][1],
        'release': downloads[0][0],
    }, content_type = 'application/xml')
예제 #9
0
def pad(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)

    release = downloads[0][0]
    download = downloads[0][1].filter(location__iendswith='.zip')[0]

    return render(request, 'downloads/pad/%s.xml' % program, {
        'download': download,
        'release': release,
    }, content_type = 'application/xml')
예제 #10
0
파일: views.py 프로젝트: pthakkar92/wammu
def pad(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, 'source')

    release = downloads[0][0]
    download = downloads[0][1].filter(location__iendswith='.zip')[0]

    return render_to_response('downloads/pad/%s.xml' % program, RequestContext(request, {
        'download': download,
        'release': release,
    }), content_type = 'application/xml')
예제 #11
0
파일: views.py 프로젝트: yeputons/website
def doap(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)

    return render(
        request,
        "downloads/doap/%s.xml" % program,
        {
            "downloads": downloads[0][1],
            "release": downloads[0][0],
        },
        content_type="application/xml",
    )
예제 #12
0
파일: views.py 프로젝트: juanjosezg/website
def pad(request, program):
    if not program in [x[0] for x in PROGRAM_CHOICES]:
        raise Http404('No such program %s.' % program)

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

    if program == 'wammu':
        downloads = get_current_downloads(program, 'source')

        release = downloads[0][0]
        download = downloads[0][1].filter(location__icontains = '.zip')[0]
    else:
        downloads = get_current_downloads(program, 'win32')

        release = downloads[0][0]
        download = downloads[0][1].filter(Q(location__icontains = 'setup.exe') | Q(location__icontains = 'windows.exe'))[0]

    return render_to_response('downloads/pad/%s.xml' % program, RequestContext(request, {
        'mirrors': mirrors,
        'mirror': mirror,
        'download': download,
        'release': release,
        'platforms': PLATFORM_CHOICES,
    }), mimetype = 'application/xml')
예제 #13
0
파일: views.py 프로젝트: juanjosezg/website
def doap(request, program):
    if not program in [x[0] for x in PROGRAM_CHOICES]:
        raise Http404('No such program %s.' % program)

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

    downloads = get_current_downloads(program, None)

    return render_to_response('downloads/doap/%s.xml' % program, RequestContext(request, {
        'mirrors': mirrors,
        'mirror': mirror,
        'downloads': downloads[0][1],
        'release': downloads[0][0],
        'platforms': PLATFORM_CHOICES,
    }), mimetype = 'application/xml')
예제 #14
0
def pad(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)

    release = downloads[0][0]
    try:
        download = downloads[0][1].filter(location__iendswith='windows.exe')[0]
    except IndexError:
        download = downloads[0][1].filter(location__iendswith='.zip')[0]

    return render(request, 'downloads/pad/%s.xml' % program, {
        'download': download,
        'release': release,
    }, content_type = 'application/xml')
예제 #15
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,
    }))
예제 #16
0
파일: views.py 프로젝트: juanjosezg/website
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
예제 #17
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,
        })
예제 #18
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