2011-05-13 15:17:58 +02:00
|
|
|
from ckan.lib.navl.validators import (ignore_missing,
|
|
|
|
not_empty,
|
|
|
|
empty,
|
|
|
|
ignore,
|
|
|
|
not_missing
|
|
|
|
)
|
|
|
|
|
2012-02-14 15:24:32 +01:00
|
|
|
from ckanext.harvest.logic.validators import (harvest_source_id_exists,
|
|
|
|
harvest_source_url_validator,
|
|
|
|
harvest_source_type_exists,
|
|
|
|
harvest_source_config_validator,
|
|
|
|
harvest_source_active_validator,)
|
2011-05-13 15:17:58 +02:00
|
|
|
|
|
|
|
def default_harvest_source_schema():
|
|
|
|
|
|
|
|
schema = {
|
|
|
|
'id': [ignore_missing, unicode, harvest_source_id_exists],
|
|
|
|
'url': [not_empty, unicode, harvest_source_url_validator],
|
|
|
|
'type': [not_empty, unicode, harvest_source_type_exists],
|
|
|
|
'description': [ignore_missing],
|
2012-02-14 15:24:32 +01:00
|
|
|
'active': [ignore_missing,harvest_source_active_validator],
|
2011-05-13 15:17:58 +02:00
|
|
|
'user_id': [ignore_missing],
|
|
|
|
'publisher_id': [ignore_missing],
|
2011-06-07 16:32:46 +02:00
|
|
|
'config': [ignore_missing,harvest_source_config_validator]
|
2011-05-13 15:17:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return schema
|
|
|
|
|
|
|
|
|
|
|
|
def harvest_source_form_schema():
|
|
|
|
|
|
|
|
schema = default_harvest_source_schema()
|
|
|
|
schema['save'] = [ignore]
|
|
|
|
|
|
|
|
return schema
|