def test_parse_mask(): source = 'field,field2,relation.field,relation.field2,relation.relation2.field,relation.relation2.relation3.field,field3' # noqa assert parse_mask(source) == { 'field': {}, 'field2': {}, 'field3': {}, 'relation': { 'field': {}, 'field2': {}, 'relation2': { 'field': {}, 'relation3': { 'field': {} } } } }
def get_collection_mask(self): fields = request.args.get('fields') if not fields: fields = ','.join(self.model.collection_fields) return parse_mask(fields)
def get_mask(self): fields = request.args.get('fields', '*') return parse_mask(fields)