Allow sources with existing URLs if the existing ones are inactive
This commit is contained in:
parent
bc8caebc30
commit
b5aea2d863
|
@ -82,12 +82,16 @@ class ViewController(BaseController):
|
|||
if e.getcode() == 500:
|
||||
msg = msg + ' Does the source already exist?'
|
||||
elif e.getcode() == 400:
|
||||
c.form = e.read()
|
||||
c.mode = 'create'
|
||||
return render('ckanext/harvest/create.html')
|
||||
else:
|
||||
h.flash_error(msg)
|
||||
redirect(h.url_for(controller='harvest', action='index'))
|
||||
err_msg = e.read()
|
||||
if '<form' in c.form:
|
||||
c.form = err_msg
|
||||
c.mode = 'create'
|
||||
return render('ckanext/harvest/create.html')
|
||||
else:
|
||||
msg = err_msg
|
||||
|
||||
h.flash_error(msg)
|
||||
redirect(h.url_for(controller='harvest', action='index'))
|
||||
|
||||
def show(self,id):
|
||||
try:
|
||||
|
|
|
@ -161,9 +161,9 @@ def create_harvest_source(source_dict):
|
|||
raise Exception('Missing mandatory properties: url, type')
|
||||
|
||||
# Check if source already exists
|
||||
exists = get_harvest_sources(url=source_dict['url'])
|
||||
exists = get_harvest_sources(url=source_dict['url'],active=True)
|
||||
if len(exists):
|
||||
raise Exception('There is already a Harvest Source for this URL: %s' % source_dict['url'])
|
||||
raise Exception('There already is an active Harvest Source for this URL: %s' % source_dict['url'])
|
||||
|
||||
source = HarvestSource()
|
||||
source.url = source_dict['url']
|
||||
|
|
Loading…
Reference in New Issue