use hasattr for config validation
This commit is contained in:
parent
7b61fb62bf
commit
13f2fb3b96
|
@ -83,10 +83,7 @@ def harvest_source_config_validator(key,data,errors,context):
|
||||||
for harvester in PluginImplementations(IHarvester):
|
for harvester in PluginImplementations(IHarvester):
|
||||||
info = harvester.info()
|
info = harvester.info()
|
||||||
if info['name'] == harvester_type:
|
if info['name'] == harvester_type:
|
||||||
if info.get('form_config_interface','') != 'Text':
|
if hasattr(harvester, 'validate_config'):
|
||||||
raise Invalid('This harvester does not allow configuration options: %s' % harvester_type)
|
|
||||||
|
|
||||||
if harvester.validate_config:
|
|
||||||
try:
|
try:
|
||||||
return harvester.validate_config(data[key])
|
return harvester.validate_config(data[key])
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
|
|
@ -34,7 +34,6 @@ class Harvest(SingletonPlugin):
|
||||||
|
|
||||||
map.connect('harvesting_job_create', '/harvest/refresh/:id',controller=controller,
|
map.connect('harvesting_job_create', '/harvest/refresh/:id',controller=controller,
|
||||||
action='create_harvesting_job')
|
action='create_harvesting_job')
|
||||||
|
|
||||||
return map
|
return map
|
||||||
|
|
||||||
def update_config(self, config):
|
def update_config(self, config):
|
||||||
|
|
Loading…
Reference in New Issue