def normalize_docs self model import_attribute self _options get model

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
def normalize_docs(self):
model = import_attribute(self._options.get('model'))
temp_view = """
function (doc){
if( doc.doc_type == '%s' ){
emit(doc._id, doc);
}
}"""
for key, value in model.all_properties(model()).items():
if isinstance(value, TagListProperty):
doc_list = model.temp_view(temp_view % model._doc_type, model)
print list(doc_list)