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
742f4237
Commit
742f4237
authored
6 years ago
by
anonymous
Browse files
Options
Downloads
Patches
Plain Diff
munges title to name for every created dataset
parent
1e2b4c77
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ckanext/odsh/logic/__init__.py
+0
-0
0 additions, 0 deletions
ckanext/odsh/logic/__init__.py
ckanext/odsh/logic/action.py
+25
-0
25 additions, 0 deletions
ckanext/odsh/logic/action.py
ckanext/odsh/plugin.py
+7
-0
7 additions, 0 deletions
ckanext/odsh/plugin.py
with
32 additions
and
0 deletions
ckanext/odsh/logic/__init__.py
0 → 100644
+
0
−
0
View file @
742f4237
This diff is collapsed.
Click to expand it.
ckanext/odsh/logic/action.py
0 → 100644
+
25
−
0
View file @
742f4237
import
logging
from
ckan.logic.action.create
import
package_create
import
ckan.model
as
model
log
=
logging
.
getLogger
(
__name__
)
def
odsh_package_create
(
context
,
data_dict
):
log
.
debug
(
'
in ODSH package_create
'
)
munge_increment_name
(
data_dict
)
return
package_create
(
context
,
data_dict
)
def
munge_increment_name
(
data_dict
):
log
.
debug
(
'
IN MUNGE
'
)
from
ckan.lib.munge
import
munge_title_to_name
name_base
=
name
=
munge_title_to_name
(
data_dict
[
'
title
'
])
pkg
=
model
.
Package
.
get
(
name
)
i
=
0
while
pkg
:
i
+=
1
name
=
name_base
+
str
(
i
)
pkg
=
model
.
Package
.
get
(
name
)
log
.
debug
(
'
name: %s
'
%
name
)
data_dict
[
'
name
'
]
=
name
This diff is collapsed.
Click to expand it.
ckanext/odsh/plugin.py
+
7
−
0
View file @
742f4237
...
@@ -11,6 +11,7 @@ import ckan.model as model
...
@@ -11,6 +11,7 @@ import ckan.model as model
from
ckanext.odsh.lib.uploader
import
ODSHResourceUpload
from
ckanext.odsh.lib.uploader
import
ODSHResourceUpload
import
ckan.lib.helpers
as
helpers
import
ckan.lib.helpers
as
helpers
import
helpers
as
odsh_helpers
import
helpers
as
odsh_helpers
import
ckanext.odsh.logic.action
as
action
from
itertools
import
count
from
itertools
import
count
from
routes.mapper
import
SubMapper
from
routes.mapper
import
SubMapper
...
@@ -298,6 +299,12 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
...
@@ -298,6 +299,12 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
plugins
.
implements
(
plugins
.
IDatasetForm
)
plugins
.
implements
(
plugins
.
IDatasetForm
)
plugins
.
implements
(
plugins
.
IValidators
)
plugins
.
implements
(
plugins
.
IValidators
)
plugins
.
implements
(
plugins
.
IPackageController
,
inherit
=
True
)
plugins
.
implements
(
plugins
.
IPackageController
,
inherit
=
True
)
plugins
.
implements
(
plugins
.
IActions
)
# IActions
def
get_actions
(
self
):
return
{
'
package_create
'
:
action
.
odsh_package_create
}
# IConfigurer
# IConfigurer
...
...
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