dspy文件修复(27个entcms + 10个dingdingflow): - 删除所有import语句(dspy环境已预加载) - 替换 sor = DBPools().sqlorContext() 为 async with db.sqlorContext() as sor: - 替换 print(json.dumps()) 为 return - 替换 uuid() 为 getID() - 替换 datetime.datetime.now() 为 datetime.now() - 修复 get_user() 缺少 await - 删除shebang/docstrings等无关内容 - 修正缩进 Python模块修复: - entcms/init.py: DBNAME从'entcms'改为'ocai_cms' - app/global_func.py: get_module_dbname返回'ocai_cms'而非'sage' - 所有函数使用 async with db.sqlorContext() as sor: 正确模式
16 lines
520 B
Plaintext
16 lines
520 B
Plaintext
|
|
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)
|
|
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)}
|