Exemplo n.º 1
0
def list_label(appname):
    data = {}
    label = []
    app_names = NAV_DICT.keys()
    for app_name in app_names:
        app_dict = {}
        app_display = NAV_DICT.get(app_name)
        app_dict.setdefault("display_value", app_display)
        app_dict.setdefault("value", app_name)
        label.append(app_dict)
    data.setdefault("navigate", label)
    return json_response_ok(data, msg="")
Exemplo n.º 2
0
    def wrapper(*args, **kwargs):
        # check projectname args
        projectname = kwargs.get("projectname")
        if projectname:
            if projectname not in NAV_DICT.keys():
                return json_response_error(
                    PARAM_ERROR, msg="invalid projectname: %s" % projectname)

        # check appname args
        appname = kwargs.get("appname")
        if appname not in MONGO_CONFIG:
            return json_response_error(
                PARAM_ERROR, msg="appname error, check url")

        # check applabel args
        applabel = kwargs.get("applabel")
        if applabel:
            app_cond = {'name': applabel, "app_name": projectname}
            if not App.find_one(appname, app_cond):
                return json_response_error(
                    PARAM_ERROR, msg="the app label not exist")

        # check module args
        module = kwargs.get("module")
        if module:
            module_cond = {'module_name': module, "app_name": projectname}
            if not Module.find_one(appname, module_cond):
                return json_response_error(
                    PARAM_ERROR, msg="the app module not exist")

        # check id args
        id = kwargs.get("id")
        if id:
            try:
                id = int(id)
            except ValueError:
                return json_response_error(PARAM_ERROR, msg="id error")
        return func(*args, **kwargs)