Example #1
0
def module_list(appname):
    sort = [("order", 1), ("_id", 1)]
    module_cursor = Module.find_module(appname, {}, fields=None).sort(sort)
    total = Module.find_module(appname, {}).count()
    modules = []
    for item in module_cursor:
        item["id"] = item.pop("_id")
        modules.append(item)
    data = {}
    data.setdefault("items", modules)
    data.setdefault("total", total)
    return json_response_ok(data)
Example #2
0
def order_module(appname, projectname, modules):
    sort = [("order", 1), ("_id", 1)]
    cond = {"app_name": projectname, "module_name": {"$in": modules}}
    module_cursor = Module.find_module(appname, cond, fields=None).sort(sort)
    app_names = []
    app_names = [item["module_name"] for item in module_cursor]
    return app_names