From 763f07fcadfb970e2bb907130519f8d41fad14d4 Mon Sep 17 00:00:00 2001 From: amercader Date: Wed, 7 Mar 2012 15:20:49 +0000 Subject: [PATCH] [logic,cli] Add session to the context in cli commands --- ckanext/harvest/commands/harvester.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ckanext/harvest/commands/harvester.py b/ckanext/harvest/commands/harvester.py index 1409b85..754d9ac 100644 --- a/ckanext/harvest/commands/harvester.py +++ b/ckanext/harvest/commands/harvester.py @@ -181,7 +181,7 @@ class Harvester(CkanCommand): else: print 'Please provide a source id' sys.exit(1) - context = {'model': model, 'user': self.admin_user['name']} + context = {'model': model, 'user': self.admin_user['name'], 'session':model.Session} get_action('harvest_source_delete')(context,{'id':source_id}) print 'Removed harvest source: %s' % source_id @@ -213,14 +213,14 @@ class Harvester(CkanCommand): self.print_there_are('harvest jobs', jobs, condition=status) def list_harvest_jobs(self): - context = {'model': model, 'user': self.admin_user['name']} + context = {'model': model, 'user': self.admin_user['name'], 'session':model.Session} jobs = get_action('harvest_job_list')(context,{}) self.print_harvest_jobs(jobs) self.print_there_are(what='harvest job', sequence=jobs) def run_harvester(self): - context = {'model': model, 'user': self.admin_user['name']} + context = {'model': model, 'user': self.admin_user['name'], 'session':model.Session} jobs = get_action('harvest_jobs_run')(context,{}) #print 'Sent %s jobs to the gather queue' % len(jobs) @@ -236,7 +236,7 @@ class Harvester(CkanCommand): print '%s objects reimported' % len(objs) def create_harvest_job_all(self): - context = {'model': model, 'user': self.admin_user['name']} + context = {'model': model, 'user': self.admin_user['name'], 'session':model.Session} jobs = get_action('harvest_job_create_all')(context,{}) print 'Created %s new harvest jobs' % len(jobs)