@@ -371,46 +371,37 @@ def store(self, db):
371
371
db [self .id ] = self ._data
372
372
return self
373
373
374
- def query (cls , db , map_fun , reduce_fun , language = 'javascript' ,
375
- eager = False , ** options ):
374
+ def query (cls , db , map_fun , reduce_fun , language = 'javascript' , ** options ):
376
375
"""Execute a CouchDB temporary view and map the result values back to
377
376
objects of this schema.
378
377
379
378
Note that by default, any properties of the document that are not
380
379
included in the values of the view will be treated as if they were
381
- missing from the document. If you'd rather want to load the full
382
- document for every row, set the `eager` option to `True`, but note that
383
- this will initiate a new HTTP request for every document, unless the
384
- ``include_docs`` option is explitly specified.
380
+ missing from the document. If you want to load the full document for
381
+ every row, set the ``include_docs`` option to ``True``.
385
382
"""
386
383
def _wrapper (row ):
387
- if eager :
388
- if row .doc is not None :
389
- return row .doc
390
- return cls .load (db , row .id )
384
+ if row .doc is not None :
385
+ return cls .wrap (row .doc )
391
386
data = row .value
392
387
data ['_id' ] = row .id
393
388
return cls .wrap (data )
394
389
return db .query (map_fun , reduce_fun = reduce_fun , language = language ,
395
390
wrapper = _wrapper , ** options )
396
391
query = classmethod (query )
397
392
398
- def view (cls , db , viewname , eager = False , ** options ):
393
+ def view (cls , db , viewname , ** options ):
399
394
"""Execute a CouchDB named view and map the result values back to
400
395
objects of this schema.
401
396
402
397
Note that by default, any properties of the document that are not
403
398
included in the values of the view will be treated as if they were
404
- missing from the document. If you'd rather want to load the full
405
- document for every row, set the `eager` option to `True`, but note that
406
- this will initiate a new HTTP request for every document, unless the
407
- ``include_docs`` option is explitly specified.
399
+ missing from the document. If you want to load the full document for
400
+ every row, set the ``include_docs`` option to ``True``.
408
401
"""
409
402
def _wrapper (row ):
410
- if eager :
411
- if row .doc is not None :
412
- return row .doc
413
- return cls .load (db , row .id )
403
+ if row .doc is not None : # include_docs=True
404
+ return cls .wrap (row .doc )
414
405
data = row .value
415
406
data ['_id' ] = row .id
416
407
return cls .wrap (data )
0 commit comments