Permalink
Browse files

Fixed paginator to actually use the input keyword arguments.

  • Loading branch information...
mharju authored and nailor committed Oct 14, 2011
1 parent f0b3346 commit 70df226826dd8e83c6fba02c83d88f41ebed32b0
Showing with 8 additions and 6 deletions.
  1. +8 −6 trombi/client.py
View
@@ -812,7 +812,7 @@ def __init__(self, db, limit=10):
self.end_doc_id = None
def get_page(self, design_doc, viewname, callback,
- key=None, doc_id=None, forward=True, **kwargs):
+ key=None, doc_id=None, forward=True, **kw):
"""
On success, callback is called with this Paginator object as an
argument that is fully populated with the page data requested.
@@ -863,12 +863,14 @@ def _really_callback(response):
kwargs = {'limit': self._limit,
'descending': True}
- kwargs.update(kwargs)
- if key and forward:
- kwargs['startkey'] = key
- kwargs['start_doc_id'] = doc_id if doc_id else ''
- elif key:
+ kwargs.update(kw)
+
+ if 'startkey' not in kwargs:
kwargs['startkey'] = key
+
+ if kwargs['startkey'] and forward and doc_id:
+ kwargs['start_doc_id'] = doc_id
+ elif kwargs['startkey'] and not forward:
kwargs['start_doc_id'] = doc_id if doc_id else ''
kwargs['descending'] = False if kwargs['descending'] else True
kwargs['skip'] = 1

0 comments on commit 70df226

Please sign in to comment.