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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Transparenzportal
ckanext-odsh
Commits
75a26994
Commit
75a26994
authored
Apr 15, 2020
by
Benjamin Becker
Browse files
Options
Downloads
Patches
Plain Diff
fixes bugs in controller
parent
b02bc762
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ckanext/odsh/collection/controller.py
+2
-2
2 additions, 2 deletions
ckanext/odsh/collection/controller.py
ckanext/odsh/collection/helpers.py
+3
-1
3 additions, 1 deletion
ckanext/odsh/collection/helpers.py
with
5 additions
and
3 deletions
ckanext/odsh/collection/controller.py
+
2
−
2
View file @
75a26994
...
...
@@ -16,7 +16,7 @@ class LatestRecourcesController(PackageController):
def
latest_resource
(
self
,
id
,
type
):
latest_resources
=
get_latest_resources_for_format
(
id
,
format
)
if
latest_resources
is
None
:
abort
(
404
)
toolkit
.
abort
(
404
)
url_type
=
latest_resources
.
get
(
'
url_type
'
)
if
url_type
is
None
:
resource_url
=
latest_resources
.
get
(
'
url
'
)
...
...
@@ -35,4 +35,4 @@ class LatestRecourcesController(PackageController):
filename
=
pre_resource_url
,
qualified
=
True
)
toolkit
.
redirect_to
(
url_resource
)
abort
(
404
)
\ No newline at end of file
toolkit
.
abort
(
404
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
ckanext/odsh/collection/helpers.py
+
3
−
1
View file @
75a26994
...
...
@@ -136,6 +136,8 @@ def get_latest_resources_for_format(collection_name, resource_format):
return
None
latest_dataset
=
members
[
-
1
]
resources
=
latest_dataset
.
get
(
'
resources
'
)
resources_with_asked_type
=
[
r
for
r
in
resources
if
r
.
get
(
'
format
'
)
==
resource_format
]
if
not
resources
:
return
None
resources_with_asked_type
=
[
r
for
r
in
resources
if
r
.
get
(
'
format
'
).
upper
()
==
resource_format
.
upper
()]
resources_sorted
=
sorted
(
resources_with_asked_type
,
key
=
itemgetter
(
'
id
'
,
'
created
'
),
reverse
=
True
)
return
resources_sorted
[
-
1
]
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