Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
ckanext-odsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Transparenzportal
ckanext-odsh
Commits
e30a4317
Commit
e30a4317
authored
5 years ago
by
Daniel Neuwirth
Browse files
Options
Downloads
Plain Diff
Merge branch 'dev' of
https://bitbucket.dataport.de/scm/tpsh/ckanext-odsh
into dev
parents
f3ff1284
7906228e
Branches
Detailinfo
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ckanext/odsh/lib/uploader.py
+3
-0
3 additions, 0 deletions
ckanext/odsh/lib/uploader.py
ckanext/odsh/plugin.py
+0
-1
0 additions, 1 deletion
ckanext/odsh/plugin.py
with
3 additions
and
1 deletion
ckanext/odsh/lib/uploader.py
+
3
−
0
View file @
e30a4317
...
@@ -29,6 +29,7 @@ def raise_validation_error_if_virus_found(filename, upload_file):
...
@@ -29,6 +29,7 @@ def raise_validation_error_if_virus_found(filename, upload_file):
def
calculate_hash
(
upload_file
):
def
calculate_hash
(
upload_file
):
upload_file
.
seek
(
0
)
hash_md5
=
hashlib
.
md5
()
hash_md5
=
hashlib
.
md5
()
for
chunk
in
iter
(
lambda
:
upload_file
.
read
(
4096
),
b
""
):
for
chunk
in
iter
(
lambda
:
upload_file
.
read
(
4096
),
b
""
):
hash_md5
.
update
(
chunk
)
hash_md5
.
update
(
chunk
)
...
@@ -41,6 +42,8 @@ def _raise_validation_error_if_hash_values_differ(upload_file, resource):
...
@@ -41,6 +42,8 @@ def _raise_validation_error_if_hash_values_differ(upload_file, resource):
if
hash_from_resource
:
if
hash_from_resource
:
hash_from_calculation
=
calculate_hash
(
upload_file
)
hash_from_calculation
=
calculate_hash
(
upload_file
)
if
not
hash_from_calculation
==
hash_from_resource
:
if
not
hash_from_calculation
==
hash_from_resource
:
log
.
debug
(
'
hash from calculation: {}
'
.
format
(
hash_from_calculation
))
log
.
debug
(
'
hash from resource: {}
'
.
format
(
hash_from_resource
))
raise
logic
.
ValidationError
({
'
upload
'
:
[
'
Berechneter Hash und mitgelieferter Hash sind unterschiedlich
'
]})
raise
logic
.
ValidationError
({
'
upload
'
:
[
'
Berechneter Hash und mitgelieferter Hash sind unterschiedlich
'
]})
...
...
This diff is collapsed.
Click to expand it.
ckanext/odsh/plugin.py
+
0
−
1
View file @
e30a4317
...
@@ -111,7 +111,6 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
...
@@ -111,7 +111,6 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
schema
[
'
extras
'
].
update
({
schema
[
'
extras
'
].
update
({
'
key
'
:
[
'
key
'
:
[
toolkit
.
get_converter
(
'
known_spatial_uri
'
),
toolkit
.
get_converter
(
'
known_spatial_uri
'
),
toolkit
.
get_converter
(
'
validate_licenseAttributionByText
'
),
]
]
})
})
schema
.
update
(
schema
.
update
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment