hi,
to finish the work on the ViewResult refactoring i did, various semantics need to be clarified
1. the meaning of wrapper/schema/classes in various places, and how to unify
2. the intents on Document vs StaticDocument wrt _allow_dnamic_properties for ViewResults/ Document.get_or_create
----------------------------------------
current state on wrapper/schema/classes + _allow_dnamic_properties
Database.get
wrapper -> single doc wrap
schema -> single class
Database.view
wrapper -> row wrapper (not document)
schema -> class or list of classes, messes around with _allow_dynamic_properties
Document.view
* messes around with _allow_dynamic_properties
classes -> list of classes that will replace the own Document class if given
wrapper -> row wrapper
Document.get_or_create
* messes around with _allow_dynamic_properties
* takes params instead of ctor args
in my branch (
https://github.com/benoitc/couchdbkit/pull/128 ) _allow_dynamic_properties is no longer touched by views by default, the rest is still the same
my desired state would be
SchemaMapper: object that maps json data to Document instances,
* should be constructable from class, list of classes or a SchemaMapper
* should not touch _allow_dynamic_properties (but currently does),
instead it should use something like type(cls.__name__, (cls,), {'_allow_dynamic_properties':dynamic_properties}) if it differs
*note* i just realized that SchemaMapper is mostly a conceptual thing for constructing a proper wrap function + its mapping
Database.get
wrapper -> single doc wrap
schema -> SchemaMapper
Database.view
wrapper -> row wrapper (not document)
schema -> SchemaMapper
Document.view
classes -> SchemaMapper
wrapper -> row wrapper
Document.get_or_create
* should not touch _allow_dynamic_properties
* kwargs are ctor args