Example #1
0
def releases_index(request, product):
    releases = {}
    esr_major_versions = range(
        10, int(firefox_get_latest_version(product).split('.')[0]), 7)

    if product == 'Firefox':
        major_releases = firefox_details.firefox_history_major_releases
        minor_releases = firefox_details.firefox_history_stability_releases
    elif product == 'Thunderbird':
        major_releases = product_details.thunderbird_history_major_releases
        minor_releases = product_details.thunderbird_history_stability_releases

    for release in major_releases:
        major_version = float(re.findall(r'^\d+\.\d+', release)[0])
        # The version numbering scheme of Firefox changes sometimes. The second
        # number has not been used since Firefox 4, then reintroduced with
        # Firefox ESR 24 (Bug 870540). On this index page, 24.1.x should be
        # fallen under 24.0. This pattern is a tricky part.
        converter = '%g' if int(major_version) in esr_major_versions else '%s'
        major_pattern = r'^' + re.escape(converter % round(major_version, 1))
        releases[major_version] = {
            'major': release,
            'minor': sorted(filter(lambda x: re.findall(major_pattern, x),
                                   minor_releases),
                            key=lambda x: map(lambda y: int(y), x.split('.')))
        }

    return l10n_utils.render(
        request, '{product}/releases/index.html'.format(product=product.lower()),
        {'releases': sorted(releases.items(), reverse=True)}
    )
Example #2
0
def releases_index(request, product):
    releases = {}
    esr_major_versions = range(
        10, int(firefox_get_latest_version(product).split('.')[0]), 7)

    if product == 'Firefox':
        major_releases = firefox_details.firefox_history_major_releases
        minor_releases = firefox_details.firefox_history_stability_releases
    elif product == 'Thunderbird':
        major_releases = product_details.thunderbird_history_major_releases
        minor_releases = product_details.thunderbird_history_stability_releases

    for release in major_releases:
        major_version = float(re.findall(r'^\d+\.\d+', release)[0])
        # The version numbering scheme of Firefox changes sometimes. The second
        # number has not been used since Firefox 4, then reintroduced with
        # Firefox ESR 24 (Bug 870540). On this index page, 24.1.x should be
        # fallen under 24.0. This pattern is a tricky part.
        converter = '%g' if int(major_version) in esr_major_versions else '%s'
        major_pattern = r'^' + re.escape(converter % round(major_version, 1))
        releases[major_version] = {
            'major':
            release,
            'minor':
            sorted(filter(lambda x: re.findall(major_pattern, x),
                          minor_releases),
                   key=lambda x: map(lambda y: int(y), x.split('.')))
        }

    return l10n_utils.render(
        request,
        '{product}/releases/index.html'.format(product=product.lower()),
        {'releases': sorted(releases.items(), reverse=True)})
Example #3
0
def latest_sysreq(request, channel, product):
    if product == 'thunderbird':
        version = thunderbird_get_latest_version(product, channel)
    else:
        version = firefox_get_latest_version(product, channel)

    if channel == 'beta':
        version = re.sub(r'b\d+$', 'beta', version)
    if channel == 'organizations':
        version = re.sub(r'^(\d+).+', r'\1.0', version)

    dir = 'system-requirements'
    path = [product, version, dir]
    locale = getattr(request, 'locale', None)
    if locale:
        path.insert(0, locale)
    return HttpResponseRedirect('/' + '/'.join(path) + '/')
Example #4
0
def latest_notes(request, product='firefox', channel='release'):
    if product == 'thunderbird':
        version = thunderbird_get_latest_version(product, channel)
    else:
        version = firefox_get_latest_version(product, channel)

    if channel == 'beta':
        version = re.sub(r'b\d+$', 'beta', version)
    if channel == 'organizations':
        version = re.sub(r'esr$', '', version)

    dir = 'auroranotes' if channel == 'aurora' else 'releasenotes'
    path = [product, version, dir]
    locale = getattr(request, 'locale', None)
    if locale:
        path.insert(0, locale)
    return HttpResponseRedirect('/' + '/'.join(path) + '/')
Example #5
0
def latest_sysreq(request, channel, product):
    if product == 'firefox' and channel == 'developer':
        channel = 'aurora'

    if product == 'thunderbird':
        version = thunderbird_get_latest_version(product, channel)
    else:
        version = firefox_get_latest_version(product, channel)

    if channel == 'beta':
        version = re.sub(r'b\d+$', 'beta', version)
    if channel == 'organizations':
        version = re.sub(r'^(\d+).+', r'\1.0', version)

    dir = 'system-requirements'
    path = [product, version, dir]
    locale = getattr(request, 'locale', None)
    if locale:
        path.insert(0, locale)
    return HttpResponseRedirect('/' + '/'.join(path) + '/')
Example #6
0
def latest_notes(request, product='firefox', channel='release'):
    if product == 'firefox' and channel == 'developer':
        channel = 'aurora'

    if product == 'thunderbird':
        version = thunderbird_get_latest_version(product, channel)
    else:
        version = firefox_get_latest_version(product, channel)

    if channel == 'beta':
        version = re.sub(r'b\d+$', 'beta', version)
    if channel == 'organizations':
        version = re.sub(r'esr$', '', version)

    dir = 'auroranotes' if channel == 'aurora' else 'releasenotes'
    path = [product, version, dir]
    locale = getattr(request, 'locale', None)
    if locale:
        path.insert(0, locale)
    return HttpResponseRedirect('/' + '/'.join(path) + '/')