Expose clear harvester source as a paster command
This commit is contained in:
parent
5fbfa2a4c1
commit
61bc150ae6
|
@ -112,6 +112,8 @@ class Harvester(CkanCommand):
|
|||
self.create_harvest_source()
|
||||
elif cmd == "rmsource":
|
||||
self.remove_harvest_source()
|
||||
elif cmd == 'clearsource':
|
||||
self.clear_harvest_source()
|
||||
elif cmd == 'sources':
|
||||
self.list_harvest_sources()
|
||||
elif cmd == 'job':
|
||||
|
@ -248,6 +250,16 @@ class Harvester(CkanCommand):
|
|||
get_action('harvest_source_delete')(context,{'id':source_id})
|
||||
print 'Removed harvest source: %s' % source_id
|
||||
|
||||
def clear_harvest_source(self):
|
||||
if len(self.args) >= 2:
|
||||
source_id = unicode(self.args[1])
|
||||
else:
|
||||
print 'Please provide a source id'
|
||||
sys.exit(1)
|
||||
context = {'model': model, 'user': self.admin_user['name'], 'session':model.Session}
|
||||
get_action('harvest_source_clear')(context,{'id':source_id})
|
||||
print 'Cleared harvest source: %s' % source_id
|
||||
|
||||
def list_harvest_sources(self):
|
||||
if len(self.args) >= 2 and self.args[1] == 'all':
|
||||
data_dict = {}
|
||||
|
|
Loading…
Reference in New Issue