Commit 95285e88 authored by Marko Kuder's avatar Marko Kuder
Browse files

debugging stringified archival field in resources

parent 0fbf65f9
...@@ -106,7 +106,8 @@ def update_resource(ckan_ini_filepath, resource_id, queue='bulk', force=False): ...@@ -106,7 +106,8 @@ def update_resource(ckan_ini_filepath, resource_id, queue='bulk', force=False):
# celery's task status. # celery's task status.
try: try:
result = _update_resource(resource_id, queue, log, force) result = _update_resource(resource_id, queue, log, force)
return result # serialized for Celery
return json.dumps(result)
except Exception, e: except Exception, e:
if os.environ.get('DEBUG'): if os.environ.get('DEBUG'):
raise raise
...@@ -288,8 +289,9 @@ def _update_resource(resource_id, queue, log, force): ...@@ -288,8 +289,9 @@ def _update_resource(resource_id, queue, log, force):
_save(Status.by_text('Archived successfully'), '', resource, _save(Status.by_text('Archived successfully'), '', resource,
download_result_mock['url_redirected_to'], download_result_mock, archive_result_mock) download_result_mock['url_redirected_to'], download_result_mock, archive_result_mock)
# The return value is only used by tests. Serialized for Celery. #this used to be serialized to JSON string (supposedly for Celery). Moved the serialization to resource_update
return json.dumps(dict(download_result_mock, **archive_result_mock)) #to avoid bugs because of stringified archival fields in resources
return dict(download_result_mock, **archive_result_mock)
# endif: processing locally uploaded resource # endif: processing locally uploaded resource
...@@ -365,8 +367,9 @@ def _update_resource(resource_id, queue, log, force): ...@@ -365,8 +367,9 @@ def _update_resource(resource_id, queue, log, force):
_save(Status.by_text('Archived successfully'), '', resource, _save(Status.by_text('Archived successfully'), '', resource,
download_result['url_redirected_to'], download_result, archive_result) download_result['url_redirected_to'], download_result, archive_result)
# The return value is only used by tests. Serialized for Celery. #this used to be serialized to JSON string (supposedly for Celery). Moved the serialization to resource_update
return json.dumps(dict(download_result, **archive_result)) #to avoid bugs because of stringified archival fields in resources
return dict(download_result, **archive_result)
def download(context, resource, url_timeout=30, def download(context, resource, url_timeout=30,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment