Ticket #2878: hit_bugfix.patch

File hit_bugfix.patch, 955 bytes (added by anonymous, 18 years ago)
  • paginator.py

     
    6767        Returns the 1-based index of the last object on the given page,
    6868        relative to total objects found (hits).
    6969        """
    70         if page_number == 0 and self.num_per_page >= self._hits:
    71             return self._hits
    72         elif page_number == (self._pages - 1) and (page_number + 1) * self.num_per_page > self._hits:
    73             return self._hits
     70        # Call this makes sure the paginator asks the database for the
     71        # number of hits.
     72        hits = self.hits
     73        if page_number == 0 and self.num_per_page >= hits:
     74            return hits
     75        elif page_number == (self._pages - 1) and (page_number + 1) * self.num_per_page > hits:
     76            return hits
    7477        return (page_number + 1) * self.num_per_page
    7578
    7679    def _get_hits(self):
Back to Top