我搜索了一段時間,但找不到有關如何從配置文件或數據庫檢索Colander Schema的參考。我認爲這不難實現,但我可能忽略了一些東西。也許有人做過或看過類似的東西,可能會分享一些見解。從配置文件或數據庫中讀取Colander Schema
這裏漏勺模式的樣本:
class PageSchema(colander.MappingSchema):
title = SchemaNode(String(),
title='Page title',
description='The title of the page',
)
description = SchemaNode(String(),
title='A short description',
description='Keep it under 60 characters or so',
missing = u'',
validator=colander.Length(max=79)
)
body = colander.SchemaNode(colander.String(),
description='Tell the world',
missing = u'')