config = getConfig('.') DBPools(config.databases) dbname = get_module_dbname('entcms') async with db.sqlorContext(dbname) as sor: content_type = params_kw.get('content_type', None) ns = {'sort': 'sort_order asc'} if content_type: ns['content_type'] = content_type rows = await sor.R('cms_categories', ns) options = [{'value': r['id'], 'text': r['name']} for r in rows] return {'status': 'ok', 'data': {'options': options}}