File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -389,6 +389,10 @@ class Pagination(object):
389
389
:type _count: int|None
390
390
"""
391
391
392
+ # Error constants
393
+ _ERROR_NO_PREVIOUS_PAGE = 'Could not generate previous page URL params: ' \
394
+ 'there is no previous page.'
395
+
392
396
# Field constants
393
397
FIELD_OLDER_ID = 'older_id'
394
398
FIELD_NEWER_ID = 'newer_id'
@@ -401,18 +405,29 @@ def __init__(self):
401
405
self ._count = None
402
406
403
407
@property
404
- def url_params_previous (self ):
408
+ def url_params_previous_page (self ):
405
409
"""
406
410
:rtype: dict[str, str]
411
+ :raise: exception.BunqException When there is no previous page.
407
412
"""
408
413
414
+ if not self .has_previous_item ():
415
+ raise exception .BunqException (self ._ERROR_NO_PREVIOUS_PAGE )
416
+
409
417
params = {
410
418
self .FIELD_OLDER_ID : str (self ._older_id ),
411
419
}
412
420
self ._add_count_to_params_if_needed (params )
413
421
414
422
return params
415
423
424
+ def has_previous_item (self ):
425
+ """
426
+ :rtype: bool
427
+ """
428
+
429
+ return self ._older_id is not None
430
+
416
431
def _add_count_to_params_if_needed (self , params ):
417
432
"""
418
433
:type params: dict[str, str]
@@ -442,7 +457,7 @@ def has_next_item_assured(self):
442
457
return self ._newer_id is not None
443
458
444
459
@property
445
- def url_params_next (self ):
460
+ def url_params_next_page (self ):
446
461
"""
447
462
:rtype: dict[str, str]
448
463
"""
You can’t perform that action at this time.
0 commit comments