Fix code style to be more ckan-like whilst still pep8.
This commit is contained in:
parent
20531c0dda
commit
8c1f7619cb
|
@ -6,21 +6,23 @@ log = logging.getLogger(__name__)
|
|||
|
||||
|
||||
def harvest_source_delete(context, data_dict):
|
||||
'''Deletes an existing harvest source.
|
||||
'''Deletes an existing harvest source
|
||||
|
||||
This method just proxies the request to package_delete,
|
||||
which will delete the actual harvest type dataset and the
|
||||
HarvestSource object (via the after_delete extension point).
|
||||
|
||||
:param id: the name or id of the harvest source to delete
|
||||
:type id: string
|
||||
'''
|
||||
|
||||
log.info('Deleting harvest source: %r', data_dict)
|
||||
|
||||
p.toolkit.check_access('harvest_source_delete', context, data_dict)
|
||||
|
||||
p.toolkit.get_action('package_delete')(context, data_dict)
|
||||
|
||||
if context.get('clear_source', False):
|
||||
# We need the id, the name won't work.
|
||||
# We need the id. The name won't work.
|
||||
package_dict = p.toolkit.get_action('package_show')(context, data_dict)
|
||||
|
||||
p.toolkit.get_action('harvest_source_clear')(
|
||||
|
|
|
@ -266,7 +266,6 @@ def harvest_objects_import(context, data_dict):
|
|||
:param package_id: the id or name of the package to import
|
||||
:type package_id: string
|
||||
'''
|
||||
|
||||
log.info('Harvest objects import: %r', data_dict)
|
||||
check_access('harvest_objects_import', context, data_dict)
|
||||
|
||||
|
@ -540,7 +539,7 @@ def harvest_sources_reindex(context, data_dict):
|
|||
|
||||
@logic.side_effect_free
|
||||
def harvest_source_reindex(context, data_dict):
|
||||
'''Reindex a single harvest source.'''
|
||||
'''Reindex a single harvest source'''
|
||||
|
||||
harvest_source_id = logic.get_or_bust(data_dict, 'id')
|
||||
defer_commit = context.get('defer_commit', False)
|
||||
|
|
|
@ -60,17 +60,17 @@ def _normalize_url(url):
|
|||
|
||||
|
||||
def harvest_source_url_validator(key, data, errors, context):
|
||||
'''Validate the provided harvest source URL.
|
||||
'''Validate the provided harvest source URL
|
||||
|
||||
Checks that the URL is not already existing with the same config.
|
||||
'''
|
||||
|
||||
package = context.get("package")
|
||||
package = context.get('package')
|
||||
|
||||
if package:
|
||||
package_id = package.id
|
||||
else:
|
||||
package_id = data.get(key[:-1] + ("id",))
|
||||
package_id = data.get(key[:-1] + ('id',))
|
||||
|
||||
try:
|
||||
new_config = data.get(key[:-1] + ('config',))
|
||||
|
|
Loading…
Reference in New Issue