Add support for config options in CLI

This commit is contained in:
Adrià Mercader 2011-06-13 15:56:19 +01:00
parent 13f2fb3b96
commit ef04ce1774
1 changed files with 11 additions and 6 deletions

View File

@ -116,22 +116,27 @@ class Harvester(CkanCommand):
print 'Please provide a source type' print 'Please provide a source type'
sys.exit(1) sys.exit(1)
if len(self.args) >= 4: if len(self.args) >= 4:
active = not(self.args[3].lower() == 'false' or \ config = unicode(self.args[3])
self.args[3] == '0') else:
config = None
if len(self.args) >= 5:
active = not(self.args[4].lower() == 'false' or \
self.args[4] == '0')
else: else:
active = True active = True
if len(self.args) >= 5: if len(self.args) >= 6:
user_id = unicode(self.args[4]) user_id = unicode(self.args[5])
else: else:
user_id = u'' user_id = u''
if len(self.args) >= 6: if len(self.args) >= 7:
publisher_id = unicode(self.args[5]) publisher_id = unicode(self.args[6])
else: else:
publisher_id = u'' publisher_id = u''
try: try:
source = create_harvest_source({ source = create_harvest_source({
'url':url, 'url':url,
'type':type, 'type':type,
'config':config,
'active':active, 'active':active,
'user_id':user_id, 'user_id':user_id,
'publisher_id':publisher_id}) 'publisher_id':publisher_id})