def current_page_size(self): try: if self.first is not None and self.first != "": fetch_size = urler.get_query_param(self.first, "fetchSize") return int(fetch_size) except (ValueError, TypeError): pass return -1
def current_page(self): # oddly, we have to work this out by looking at the previous and next pages # although the JSON serialisation does actually provide this as part of # the data, the XML serialisation does not, so this is suitably general if self.previous is None or self.previous == "": return 1 if self.next is None or self.next == "": return self.pages prev_page = urler.get_query_param(self.previous, "page") try: return int(prev_page) + 1 except (ValueError, TypeError): pass next_page = urler.get_query_param(self.next, "page") try: return int(next_page) - 1 except (ValueError, TypeError): pass return -1