Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
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
Open-Data
ckanext-odsh
Commits
850c6381
Commit
850c6381
authored
2 years ago
by
Thorge Petersen
Browse files
Options
Downloads
Patches
Plain Diff
Removed custom ApiController
parent
f977025b
No related branches found
No related tags found
2 merge requests
!41
Version 2.0.0
,
!38
Merge py3 into dev
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ckanext/odsh/controller.py
+0
-40
0 additions, 40 deletions
ckanext/odsh/controller.py
ckanext/odsh/plugin.py
+1
-11
1 addition, 11 deletions
ckanext/odsh/plugin.py
with
1 addition
and
51 deletions
ckanext/odsh/controller.py
+
0
−
40
View file @
850c6381
...
...
@@ -28,46 +28,6 @@ render = base.render
get_action
=
logic
.
get_action
class
OdshApiController
(
ApiController
):
def
action
(
self
,
logic_function
,
ver
=
None
):
if
toolkit
.
asbool
(
config
.
get
(
'
ckanext.odsh.log_api_requests
'
,
'
false
'
)):
try
:
request_data
=
self
.
_get_request_data
(
try_url_params
=
False
)
log
.
info
(
'
POST request body: {}
'
.
format
(
request_data
))
except
Exception
as
e
:
log
.
error
(
e
)
if
logic_function
==
'
resource_qv4yAI2rgotamXGk98gJ
'
:
return
helpers
.
odsh_get_version_id
()
if
logic_function
==
'
resourcelog_qv4yAI2rgotamXGk98gJ
'
:
if
config
.
get
(
'
ckanext.odsh.enabletestendpoints
'
,
None
)
==
'
True
'
:
log
.
info
(
'
This is an info test log
'
)
log
.
warning
(
'
This is an warning test log
'
)
log
.
error
(
'
This is an error test log
'
)
return
'
ok
'
try
:
function
=
logic
.
get_action
(
logic_function
)
side_effect_free
=
getattr
(
function
,
'
side_effect_free
'
,
False
)
request_data
=
self
.
_get_request_data
(
try_url_params
=
side_effect_free
)
if
isinstance
(
request_data
,
dict
):
id
=
request_data
.
get
(
'
id
'
,
''
)
if
'
q
'
in
request_data
:
id
=
request_data
[
'
q
'
]
if
'
query
'
in
request_data
:
id
=
request_data
[
'
query
'
]
userid
=
None
if
c
.
user
:
userid
=
hashlib
.
md5
(
c
.
user
).
hexdigest
()[:
16
]
# matomo.create_matomo_request(userid)
#else:
# matomo.create_matomo_request()
except
Exception
as
e
:
log
.
error
(
e
)
return
ApiController
.
action
(
self
,
logic_function
,
ver
)
class
OdshFeedController
(
FeedController
):
def
custom
(
self
):
extra_fields
=
[
'
ext_startdate
'
,
'
ext_enddate
'
,
...
...
This diff is collapsed.
Click to expand it.
ckanext/odsh/plugin.py
+
1
−
11
View file @
850c6381
...
...
@@ -294,20 +294,10 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
map
.
redirect
(
'
/dataset/{id}/resource/{resource_id}
'
,
'
/dataset/{id}
'
)
# /api ver 3
GET_POST
=
dict
(
method
=
[
'
GET
'
,
'
POST
'
])
with
SubMapper
(
map
,
controller
=
'
ckanext.odsh.controller:OdshApiController
'
,
path_prefix
=
'
/api{ver:/3|}
'
,
ver
=
'
/3
'
)
as
m
:
m
.
connect
(
'
/action/{logic_function}
'
,
action
=
'
action
'
,
conditions
=
GET_POST
)
with
SubMapper
(
map
,
controller
=
'
ckanext.odsh.controller:OdshFeedController
'
)
as
m
:
m
.
connect
(
'
/feeds/custom.atom
'
,
action
=
'
custom
'
)
# redirect all user routes to custom controller
# with SubMapper(map, controller='ckanext.odsh.controller:OdshUserController') as m:
# m.connect('/user/edit', action='edit')
...
...
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