Skip to content
Snippets Groups Projects
Commit 68dff595 authored by Daniel Neuwirth's avatar Daniel Neuwirth
Browse files

Hash algoirthm for rdf

parent 5da13a4a
No related branches found
No related tags found
No related merge requests found
...@@ -9,9 +9,10 @@ def save_hash_into_resource(context, resource): ...@@ -9,9 +9,10 @@ def save_hash_into_resource(context, resource):
with open(path, 'rb') as file: with open(path, 'rb') as file:
hash = calculate_hash(file) hash = calculate_hash(file)
package = update_last_resource_if_value_empty(context, resource, 'hash', hash) package = update_last_resource_if_value_empty(context, resource, 'hash', hash)
resources = package.get('resources')
last_resource = resources.pop()
if last_resource.get(hash) and not last_resource.get('hash_algorithm'):
last_resource.update({'hash_algorithm': 'http://dcat-ap.de/def/hashAlgorithms/md/5'})
resources.append(last_resource)
package.update({'resources':resources})
toolkit.get_action('package_update')(context, package) toolkit.get_action('package_update')(context, package)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment