config = getConfig('.') DBPools(config.databases) dbname = get_module_dbname('cms') async with db.sqlorContext(dbname) as sor: content_type = params_kw.get('content_type', None) limit = int(params_kw.get('limit', '10')) ns = {'status': 'published', 'sort': 'sort_order asc, published_at desc'} if content_type: ns['content_type'] = content_type rows = await sor.R('cms_content', ns) if limit: rows = rows[:limit] return {'status': 'ok', 'rows': rows, 'total': len(rows)}