(request, domain, app_id)
return render(request, "app_manager/download_index.html", {
        'app': request.app,
        'files': OrderedDict(sorted(files.items(), key=lambda x: x[0] or '')),
        'supports_j2me': request.app.build_spec.supports_j2me(),
        'build_profiles': build_profiles,
        'enabled_build_profiles': enabled_build_profiles,
        'latest_enabled_build_profiles': latest_enabled_build_profiles,
    })
A landing page, mostly for debugging, that has links the jad and jar as well as
    all the resource files that will end up zipped into the jar.
A landing page, mostly for debugging, that has links the jad and jar as well as
    all the resource files that will end up zipped into the jar.
A landing page mostly for debugging that has links the jad and jar as well as all the resource files that will end up zipped into the jar .
def download_index(request, domain, app_id):
    """
    A landing page, mostly for debugging, that has links the jad and jar as well as
    all the resource files that will end up zipped into the jar.

    """
    files = defaultdict(list)
    try:
        for file_ in source_files(request.app):
            form_filename = re.search(r'modules-(\d+)\/forms-(\d+)', file_[0])
            if form_filename:
                module_id, form_id = form_filename.groups()
                module = request.app.get_module(module_id)
                form = module.get_form(form_id)
                section_name = "m{} - {}".format(
                    module_id,
                    ", ".join(["({}) {}".format(lang, name)
                               for lang, name in module.name.items()])
                )
                files[section_name].append({
                    'name': file_[0],
                    'source': file_[1],
                    'readable_name': "f{} - {}".format(
                        form_id,
                        ", ".join(["({}) {}".format(lang, name)
                                   for lang, name in form.name.items()])
                    ),
                })
            else:
                files[None].append({
                    'name': file_[0],
                    'source': file_[1],
                    'readable_name': None,
                })
    except Exception:
        messages.error(
            request,
            _(
                "We were unable to get your files "
                "because your Application has errors. "
                "Please click <strong>Make New Version</strong> "
                "for feedback on how to fix these errors."
            ),
            extra_tags='html'
        )
    enabled_build_profiles = []
    latest_enabled_build_profiles = {}
    build_profiles = [{'id': build_profile_id, 'name': build_profile.name}
                      for build_profile_id, build_profile in request.app.build_profiles.items()]
    if request.app.is_released and toggles.RELEASE_BUILDS_PER_PROFILE.enabled(domain):
        latest_enabled_build_profiles = get_latest_enabled_versions_per_profile(request.app.copy_of)
        enabled_build_profiles = [_id for _id, version in latest_enabled_build_profiles.items()
                                  if version == request.app.version]

    return render(request, "app_manager/download_index.html", {
        'app': request.app,
        'files': OrderedDict(sorted(files.items(), key=lambda x: x[0] or '')),
        'supports_j2me': request.app.build_spec.supports_j2me(),
        'build_profiles': build_profiles,
        'enabled_build_profiles': enabled_build_profiles,
        'latest_enabled_build_profiles': latest_enabled_build_profiles,
    })
def download_index ( request , domain , app_id ) : files = defaultdict ( list ) try : for file_ in source_files ( request . app ) : form_filename = re . search ( r'modules-(\d+)\/forms-(\d+)' , file_ [ 0 ] ) if form_filename : module_id , form_id = form_filename . groups ( ) module = request . app . get_module ( module_id ) form = module . get_form ( form_id ) section_name = "m{} - {}" . format ( module_id , ", " . join ( [ "({}) {}" . format ( lang , name ) for lang , name in module . name . items ( ) ] ) ) files [ section_name ] . append ( { 'name' : file_ [ 0 ] , 'source' : file_ [ 1 ] , 'readable_name' : "f{} - {}" . format ( form_id , ", " . join ( [ "({}) {}" . format ( lang , name ) for lang , name in form . name . items ( ) ] ) ) , } ) else : files [ None ] . append ( { 'name' : file_ [ 0 ] , 'source' : file_ [ 1 ] , 'readable_name' : None , } ) except Exception : messages . error ( request , _ ( "We were unable to get your files " "because your Application has errors. " "Please click <strong>Make New Version</strong> " "for feedback on how to fix these errors." ) , extra_tags = 'html' ) enabled_build_profiles = [ ] latest_enabled_build_profiles = { } build_profiles = [ { 'id' : build_profile_id , 'name' : build_profile . name } for build_profile_id , build_profile in request . app . build_profiles . items ( ) ] if request . app . is_released and toggles . RELEASE_BUILDS_PER_PROFILE . enabled ( domain ) : latest_enabled_build_profiles = get_latest_enabled_versions_per_profile ( request . app . copy_of ) enabled_build_profiles = [ _id for _id , version in latest_enabled_build_profiles . items ( ) if version == request . app . version ] return render ( request , "app_manager/download_index.html" , { 'app' : request . app , 'files' : OrderedDict ( sorted ( files . items ( ) , key = lambda x : x [ 0 ] or '' ) ) , 'supports_j2me' : request . app . build_spec . supports_j2me ( ) , 'build_profiles' : build_profiles , 'enabled_build_profiles' : enabled_build_profiles , 'latest_enabled_build_profiles' : latest_enabled_build_profiles , } )