(request, domain)
You must specify an app_id, and you may specify either 'version' or 'latest'
    latest can be one of:
        release: Latest starred version
        build: Latest version regardless of star
        save: Latest saved version of the application (even without a build)
    If 'version' and 'latest' aren't specified it will default to latest save
    You may also set 'include_multimedia=true' if you need multimedia.
You must specify an app_id, and you may specify either 'version' or 'latest'
    latest can be one of:
        release: Latest starred version
        build: Latest version regardless of star
        save: Latest saved version of the application (even without a build)
    If 'version' and 'latest' aren't specified it will default to latest save
    You may also set 'include_multimedia=true' if you need multimedia.
You must specify an app_id and you may specify either version or latest latest can be one of : release : Latest starred version build : Latest version regardless of star save : Latest saved version of the application ( even without a build ) If version and latest aren t specified it will default to latest save You may also set include_multimedia = true if you need multimedia .
def direct_ccz(request, domain):
    """
    You must specify an app_id, and you may specify either 'version' or 'latest'
    latest can be one of:
        release: Latest starred version
        build: Latest version regardless of star
        save: Latest saved version of the application (even without a build)
    If 'version' and 'latest' aren't specified it will default to latest save
    You may also set 'include_multimedia=true' if you need multimedia.
    """

    def error(msg, code=400):
        return JsonResponse({'status': 'error', 'message': msg}, status_code=code)

    def get_app(app_id, version, latest):
        if version:
            return get_build_doc_by_version(domain, app_id, version)
        elif latest == 'build':
            return get_latest_build_doc(domain, app_id)
        elif latest == 'release':
            return get_latest_released_app_doc(domain, app_id)
        else:
            # either latest=='save' or they didn't specify
            return get_current_app(domain, app_id)

    app_id = request.GET.get('app_id', None)
    version = request.GET.get('version', None)
    latest = request.GET.get('latest', None)
    include_multimedia = request.GET.get('include_multimedia', 'false').lower() == 'true'
    visit_scheduler_enabled = toggles.VISIT_SCHEDULER.enabled_for_request(request)

    # Make sure URL params make sense
    if not app_id:
        return error("You must specify `app_id` in your GET parameters")
    if version and latest:
        return error("You can't specify both 'version' and 'latest'")
    if latest not in (None, 'release', 'build', 'save',):
        return error("latest must be either 'release', 'build', or 'save'")
    if version:
        try:
            version = int(version)
        except ValueError:
            return error("'version' must be an integer")

    try:
        app = get_app(app_id, version, latest)
        if not app:
            raise ResourceNotFound()
        app = app if isinstance(app, Document) else wrap_app(app)
    except (ResourceNotFound, DocTypeError):
        return error("Application not found", code=404)

    lang, langs = get_langs(request, app)

    with report_build_time(domain, app._id, 'live_preview'):
        return get_direct_ccz(domain, app, langs, version, include_multimedia, visit_scheduler_enabled)
def direct_ccz ( request , domain ) : def error ( msg , code = 400 ) : return JsonResponse ( { 'status' : 'error' , 'message' : msg } , status_code = code ) def get_app ( app_id , version , latest ) : if version : return get_build_doc_by_version ( domain , app_id , version ) elif latest == 'build' : return get_latest_build_doc ( domain , app_id ) elif latest == 'release' : return get_latest_released_app_doc ( domain , app_id ) else : # either latest=='save' or they didn't specify return get_current_app ( domain , app_id ) app_id = request . GET . get ( 'app_id' , None ) version = request . GET . get ( 'version' , None ) latest = request . GET . get ( 'latest' , None ) include_multimedia = request . GET . get ( 'include_multimedia' , 'false' ) . lower ( ) == 'true' visit_scheduler_enabled = toggles . VISIT_SCHEDULER . enabled_for_request ( request ) # Make sure URL params make sense if not app_id : return error ( "You must specify `app_id` in your GET parameters" ) if version and latest : return error ( "You can't specify both 'version' and 'latest'" ) if latest not in ( None , 'release' , 'build' , 'save' , ) : return error ( "latest must be either 'release', 'build', or 'save'" ) if version : try : version = int ( version ) except ValueError : return error ( "'version' must be an integer" ) try : app = get_app ( app_id , version , latest ) if not app : raise ResourceNotFound ( ) app = app if isinstance ( app , Document ) else wrap_app ( app ) except ( ResourceNotFound , DocTypeError ) : return error ( "Application not found" , code = 404 ) lang , langs = get_langs ( request , app ) with report_build_time ( domain , app . _id , 'live_preview' ) : return get_direct_ccz ( domain , app , langs , version , include_multimedia , visit_scheduler_enabled )