Add additional name argument when creating new harvest source
This commit is contained in:
parent
ade5f83e38
commit
1249564be5
|
@ -15,7 +15,7 @@ class Harvester(CkanCommand):
|
||||||
harvester initdb
|
harvester initdb
|
||||||
- Creates the necessary tables in the database
|
- Creates the necessary tables in the database
|
||||||
|
|
||||||
harvester source {url} {type} [{config}] [{active}] [{user-id}] [{publisher-id}] [{frequency}]
|
harvester source {name} {url} {type} [{config}] [{active}] [{user-id}] [{publisher-id}] [{frequency}]
|
||||||
- create new harvest source
|
- create new harvest source
|
||||||
|
|
||||||
harvester rmsource {id}
|
harvester rmsource {id}
|
||||||
|
@ -156,34 +156,40 @@ class Harvester(CkanCommand):
|
||||||
def create_harvest_source(self):
|
def create_harvest_source(self):
|
||||||
|
|
||||||
if len(self.args) >= 2:
|
if len(self.args) >= 2:
|
||||||
url = unicode(self.args[1])
|
name = unicode(self.args[1]
|
||||||
|
else:
|
||||||
|
print 'Please provide a source name'
|
||||||
|
sys.exit(1)
|
||||||
|
if len(self.args) >= 3:
|
||||||
|
url = unicode(self.args[2])
|
||||||
else:
|
else:
|
||||||
print 'Please provide a source URL'
|
print 'Please provide a source URL'
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if len(self.args) >= 3:
|
if len(self.args) >= 4:
|
||||||
type = unicode(self.args[2])
|
type = unicode(self.args[3])
|
||||||
else:
|
else:
|
||||||
print 'Please provide a source type'
|
print 'Please provide a source type'
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if len(self.args) >= 4:
|
|
||||||
config = unicode(self.args[3])
|
if len(self.args) >= 5:
|
||||||
|
config = unicode(self.args[4])
|
||||||
else:
|
else:
|
||||||
config = None
|
config = None
|
||||||
if len(self.args) >= 5:
|
if len(self.args) >= 6:
|
||||||
active = not(self.args[4].lower() == 'false' or \
|
active = not(self.args[5].lower() == 'false' or \
|
||||||
self.args[4] == '0')
|
self.args[5] == '0')
|
||||||
else:
|
else:
|
||||||
active = True
|
active = True
|
||||||
if len(self.args) >= 6:
|
if len(self.args) >= 7:
|
||||||
user_id = unicode(self.args[5])
|
user_id = unicode(self.args[6])
|
||||||
else:
|
else:
|
||||||
user_id = u''
|
user_id = u''
|
||||||
if len(self.args) >= 7:
|
if len(self.args) >= 8:
|
||||||
publisher_id = unicode(self.args[6])
|
publisher_id = unicode(self.args[7])
|
||||||
else:
|
else:
|
||||||
publisher_id = u''
|
publisher_id = u''
|
||||||
if len(self.args) >= 8:
|
if len(self.args) >= 9:
|
||||||
frequency = unicode(self.args[7])
|
frequency = unicode(self.args[8])
|
||||||
if not frequency:
|
if not frequency:
|
||||||
frequency = 'MANUAL'
|
frequency = 'MANUAL'
|
||||||
else:
|
else:
|
||||||
|
@ -192,6 +198,7 @@ class Harvester(CkanCommand):
|
||||||
data_dict = {
|
data_dict = {
|
||||||
'url':url,
|
'url':url,
|
||||||
'source_type':type,
|
'source_type':type,
|
||||||
|
'name':name,
|
||||||
'config':config,
|
'config':config,
|
||||||
'frequency':frequency,
|
'frequency':frequency,
|
||||||
'active':active,
|
'active':active,
|
||||||
|
|
Loading…
Reference in New Issue