diff --git a/ckanext/harvest/logic/action/get.py b/ckanext/harvest/logic/action/get.py index 4177507..b383249 100644 --- a/ckanext/harvest/logic/action/get.py +++ b/ckanext/harvest/logic/action/get.py @@ -216,7 +216,8 @@ def harvest_job_list(context,data_dict): jobs = query.all() - return [harvest_job_dictize(job,context) for job in jobs] + context['return_error_summary'] = False + return [harvest_job_dictize(job, context) for job in jobs] def harvest_object_show(context,data_dict): diff --git a/ckanext/harvest/logic/dictization.py b/ckanext/harvest/logic/dictization.py index bbee5a5..8415370 100644 --- a/ckanext/harvest/logic/dictization.py +++ b/ckanext/harvest/logic/dictization.py @@ -41,15 +41,16 @@ def harvest_job_dictize(job, context): for error in job.gather_errors: out['gather_errors'].append(error.as_dict()) - q = model.Session.query(HarvestObjectError.message, \ - func.count(HarvestObjectError.message).label('error_count')) \ - .join(HarvestObject) \ - .filter(HarvestObject.harvest_job_id==job.id) \ - .group_by(HarvestObjectError.message) \ - .order_by('error_count desc') \ - .limit(context.get('error_summmary_limit', 20)) + if context.get('return_error_summary', True): + q = model.Session.query(HarvestObjectError.message, \ + func.count(HarvestObjectError.message).label('error_count')) \ + .join(HarvestObject) \ + .filter(HarvestObject.harvest_job_id==job.id) \ + .group_by(HarvestObjectError.message) \ + .order_by('error_count desc') \ + .limit(context.get('error_summmary_limit', 20)) - out['error_summary'] = q.all() + out['error_summary'] = q.all() return out