Exemple #1
0
def get_api_specification(request, *args, **kwargs):

    applist = {'api_version': __VERSION__}

    applications = {}

    if len(csettings.APPS):

        installed_apps = {}
        get_pkgs(installed_apps)

        for app in installed_apps:

            applications[app] = {}
            url_prefix = installed_apps[app]['PREFIX']
            del installed_apps[app]['PREFIX']

            for m in installed_apps[app]:

                mmod = installed_apps[app][m]

                base_pkg = hasattr(mmod,'BASE') and mmod.BASE
                mm = {}
                mm['name'] = mmod.name
                mm['url'] = '/{}'.format(mmod.location) if base_pkg else '/{}/{}'.format(url_prefix, mmod.location)
                a = doc_parser(mmod)
                mm.update(a)

                applications[app][mmod.name] = mm

    applist['applications'] = applications
    applist = json.dumps(applist)

    return applist
Exemple #2
0
def get_api_specification(request, *args, **kwargs):

    applist = {'api_version': __VERSION__}

    applications = {}

    if len(csettings.APPS):

        installed_apps = {}
        get_pkgs(installed_apps)

        for app in installed_apps:

            applications[app] = {}
            url_prefix = installed_apps[app]['PREFIX']
            del installed_apps[app]['PREFIX']

            if 'APP_VERSION' in installed_apps[app]:
                applications[app]['APP_VERSION'] = installed_apps[app][
                    'APP_VERSION']
                del installed_apps[app]['APP_VERSION']

            for m in installed_apps[app]:

                mmod = installed_apps[app][m]

                base_pkg = hasattr(mmod, 'BASE') and mmod.BASE
                mm = {}
                mm['name'] = mmod.name

                a = doc_parser(mmod, url_prefix, base_pkg)
                mm.update(a)

                applications[app][mmod.name] = mm

    applist['applications'] = applications
    applist = json.dumps(applist, ensure_ascii=False)

    return applist
Exemple #3
0
def get_api_specification(request, *args, **kwargs):

    applist = {'api_version': __VERSION__}

    applications = {}

    if len(csettings.APPS):

        installed_apps = {}
        get_pkgs(installed_apps)

        for app in installed_apps:

            applications[app] = {}
            url_prefix = installed_apps[app]['PREFIX']
            del installed_apps[app]['PREFIX']

            for m in installed_apps[app]:

                mmod = installed_apps[app][m]

                base_pkg = hasattr(mmod, 'BASE') and mmod.BASE
                mm = {}
                mm['name'] = mmod.name
                mm['url'] = '/{}'.format(
                    mmod.location) if base_pkg else '/{}/{}'.format(
                        url_prefix, mmod.location)
                a = doc_parser(mmod)
                mm.update(a)

                applications[app][mmod.name] = mm

    applist['applications'] = applications
    applist = json.dumps(applist)

    return applist