Fix pager links in harvest source page

This commit is contained in:
amercader 2012-12-19 17:27:05 +00:00
parent eb50b440bf
commit 510e2d3725
1 changed files with 10 additions and 1 deletions

View File

@ -4,6 +4,8 @@ from ckan import logic
from ckan import model from ckan import model
import ckan.lib.helpers as h import ckan.lib.helpers as h
from ckanext.harvest.plugin import DATASET_TYPE_NAME
def package_list_for_source(source_id): def package_list_for_source(source_id):
''' '''
Creates a dataset list with the ones belonging to a particular harvest Creates a dataset list with the ones belonging to a particular harvest
@ -24,10 +26,17 @@ def package_list_for_source(source_id):
context = {'model': model, 'session': model.Session} context = {'model': model, 'session': model.Session}
query = logic.get_action('package_search')(context, search_dict) query = logic.get_action('package_search')(context, search_dict)
base_url = h.url_for('{0}_read'.format(DATASET_TYPE_NAME), id=source_id)
def pager_url(q=None, page=None):
url = base_url
if page:
url += '?page={0}'.format(page)
return url
pager = h.Page( pager = h.Page(
collection=query['results'], collection=query['results'],
page=page, page=page,
# url=pager_url, url=pager_url,
item_count=query['count'], item_count=query['count'],
items_per_page=limit items_per_page=limit
) )