# HG changeset patch # User Sylvain Thénault # Date 1251278139 -7200 # Node ID 62ce5a139b52cd8b45f4817a180573af4094b606 # Parent 6a40a9a72957f1ed9585ee28640ca331bc403eda [page nav] previous/next page links should also consider url's base path diff -r 6a40a9a72957 -r 62ce5a139b52 web/component.py --- a/web/component.py Wed Aug 26 11:14:47 2009 +0200 +++ b/web/component.py Wed Aug 26 11:15:39 2009 +0200 @@ -134,25 +134,21 @@ return self.selected_page_link_templ % (url, content, content) return self.page_link_templ % (url, content, content) - def previous_link(self, params, content='<<', title=_('previous_results')): + def previous_link(self, path, params, content='<<', title=_('previous_results')): start = self.starting_from if not start : return self.no_previous_page_link start = max(0, start - self.page_size) stop = start + self.page_size - 1 - url = self.build_url(**merge_dicts(params, {self.start_param : start, - self.stop_param : stop,})) - url = xml_escape(url) + url = xml_escape(self.page_url(path, params, start, stop)) return self.previous_page_link_templ % (url, title, content) - def next_link(self, params, content='>>', title=_('next_results')): + def next_link(self, path, params, content='>>', title=_('next_results')): start = self.starting_from + self.page_size if start >= self.total: return self.no_next_page_link stop = start + self.page_size - 1 - url = self.build_url(**merge_dicts(params, {self.start_param : start, - self.stop_param : stop,})) - url = xml_escape(url) + url = xml_escape(self.page_url(path, params, start, stop)) return self.next_page_link_templ % (url, title, content) diff -r 6a40a9a72957 -r 62ce5a139b52 web/views/navigation.py --- a/web/views/navigation.py Wed Aug 26 11:14:47 2009 +0200 +++ b/web/views/navigation.py Wed Aug 26 11:15:39 2009 +0200 @@ -40,9 +40,9 @@ self.index_display(start, stop))) start = stop + 1 w(u'') def index_display(self, start, stop): @@ -131,18 +131,18 @@ cell = self.format_link_content(index_display(start), index_display(stop)) blocklist.append(self.page_link(basepath, params, start, stop, cell)) start = stop + 1 - self.write_links(params, blocklist) + self.write_links(basepath, params, blocklist) def format_link_content(self, startstr, stopstr): text = u'%s - %s' % (startstr.lower()[:self.nb_chars], stopstr.lower()[:self.nb_chars]) return xml_escape(text) - def write_links(self, params, blocklist): + def write_links(self, basepath, params, blocklist): self.w(u'')