Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDataValidation implementation for Registry #1395

Merged
merged 3 commits into from
Jul 26, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ckanext/canada/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class DataGCCAInternal(p.SingletonPlugin):
p.implements(p.IPackageController, inherit=True)
p.implements(p.IActions)
p.implements(p.IResourceUrlChange)
from ckanext.validation.interfaces import IDataValidation
p.implements(IDataValidation, inherit=True)
JVickery-TBS marked this conversation as resolved.
Show resolved Hide resolved

def update_config(self, config):
p.toolkit.add_template_directory(config, 'templates/internal')
Expand Down Expand Up @@ -232,6 +234,16 @@ def get_actions(self):
resource_view_create=resource_view_create_bilingual,
)

# IDataValidation

def can_validate(self, context, resource):
"""
Only uploaded resources are allowed to be validated
"""
if resource.get(u'url_type') != u'upload':
return False
return True



@chained_action
Expand Down
Loading