import json from appPublic.uniqueID import getID config = getConfig('.') DBPools(config.databases) dbname = get_module_dbname('entcms') sor = DBPools().sqlorContext(dbname) 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] print(json.dumps({'status': 'ok', 'rows': rows, 'total': len(rows)}, ensure_ascii=False))