@@ -326,18 +326,24 @@ def format_type(format_name):
326
326
}
327
327
328
328
329
- def get_harvest_source_link (package_dict ):
329
+ def get_harvest_source_link (package_dict , type = 'source' ):
330
330
harvest_source_id = get_pkg_dict_extra (package_dict , 'harvest_source_id' , None )
331
331
harvest_source_title = get_pkg_dict_extra (package_dict , 'harvest_source_title' , None )
332
+ harvest_object_id = get_pkg_dict_extra (package_dict , 'harvest_object_id' , None )
333
+ harvest_admin_url = config .get ('ckanext.datagovtheme.harvest_admin_url' )
332
334
333
335
if harvest_source_id and harvest_source_title :
334
336
msg = p .toolkit ._ ('Harvested from' )
335
337
harvest_next = asbool (config .get ('ckanext.datagovtheme.harvest_next' , 'false' ))
336
- if harvest_next :
337
- url = h .url_for (f'/harvest/{ harvest_source_id } ' )
338
+ if type == 'metadata' :
339
+ url = f"{ harvest_admin_url } /harvest_record/{ harvest_object_id } /raw"
340
+ link = '<a href="{url}">{title}</a>' .format (url = url , title = 'Download Metadata' )
338
341
else :
339
- url = h .url_for ('harvest_read' , id = harvest_source_id )
340
- link = '{msg} <a href="{url}">{title}</a>' .format (url = url , msg = msg , title = harvest_source_title )
342
+ if harvest_next :
343
+ url = f"{ harvest_admin_url } /harvest_source/{ harvest_source_id } "
344
+ else :
345
+ url = h .url_for ('harvest_read' , id = harvest_source_id )
346
+ link = '{msg} <a href="{url}">{title}</a>' .format (url = url , msg = msg , title = harvest_source_title )
341
347
return p .toolkit .literal (link )
342
348
343
349
return ''
0 commit comments