19 lines
598 B
Plaintext
19 lines
598 B
Plaintext
|
|
config = getConfig('.')
|
|
DBPools(config.databases)
|
|
dbname = get_module_dbname('cms')
|
|
async with db.sqlorContext(dbname) as sor:
|
|
|
|
ns = {'is_visible': '1', 'sort': 'sort_order asc'}
|
|
rows = await sor.R('cms_sections', ns)
|
|
# Parse JSON fields
|
|
for r in rows:
|
|
for field in ['display_config', 'style_config', 'static_content']:
|
|
v = r.get(field, None)
|
|
if v and isinstance(v, str):
|
|
try:
|
|
r[field] = json.loads(v)
|
|
except:
|
|
pass
|
|
return {'status': 'ok', 'rows': rows, 'total': len(rows)}
|