Home | Trees | Indices | Help |
---|
|
1 24 if hasattr(schema, "wrap") and hasattr(schema, '_doc_type'): 5 schema = {schema._doc_type: schema} 6 elif isinstance(schema, list): 7 schema = dict((s._doc_type, s) for s in schema) 8 9 if dynamic_properties is not None: 10 for name, cls in schema.items(): 11 if cls._allow_dynamic_properties != dynamic_properties: 12 schema[name] = type(cls.__name__, (cls,), { 13 '_allow_dynamic_properties': dynamic_properties, 14 }) 15 return schema16 1719 doc_type_attrs = set(cls._doc_type_attr for cls in classes) 20 assert len(doc_type_attrs) == 1, "inconsistent doctype attr" 21 return doc_type_attrs.pop()22 2325 doctype_attr = doctype_attr_of(classes.values()) 26 27 def wrap(doc): 28 doc_type = doc.get(doctype_attr) 29 cls = classes[doc_type] 30 return cls.wrap(doc)31 32 return wrap 33 34 38 3941 dynamic_properties = params.pop('dynamic_properties', None) 42 return wrapper or schema_wrapper(schema, dynamic_properties)43
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri May 4 11:48:42 2012 | http://epydoc.sourceforge.net |