def download_firefox_desktop_list()

in bedrock/firefox/templatetags/helpers.py [0:0]


def download_firefox_desktop_list(ctx, channel="release", dom_id=None, locale=None, force_full_installer=False):
    """
    Return a HTML list of platform download links for Firefox desktop

    :param channel: name of channel: 'release', 'beta',  'alpha' or 'nightly'.
    :param dom_id: Use this string as the id attr on the element.
    :param locale: The locale of the download. Default to locale of request.
    :param force_full_installer: Force the installer download to not be
            the stub installer (for aurora).

    """
    dom_id = dom_id or f"download-platform-list-{channel}"
    locale = locale or get_locale(ctx["request"])

    builds = desktop_builds(
        channel, builds=None, locale=locale, force_direct=True, force_full_installer=force_full_installer, locale_in_transition=False, classified=True
    )

    recommended_builds = []
    traditional_builds = []

    for plat in builds:
        # Add 32-bit label for Windows and Linux builds.
        if channel != "nightly":
            if plat["os"] == "win":
                plat["os_pretty"] = "Windows 32-bit"

        if plat["os"] == "linux":
            plat["os_pretty"] = "Linux 32-bit"

        if plat["os"] in firefox_desktop.platform_classification["recommended"] or channel == "nightly" and plat["os"] == "win":
            recommended_builds.append(plat)
        else:
            traditional_builds.append(plat)

    data = {
        "id": dom_id,
        "builds": {
            "recommended": recommended_builds,
            "traditional": traditional_builds,
        },
    }

    html = render_to_string("firefox/includes/download-list.html", data, request=ctx["request"])
    return Markup(html)