Skip to content

Commit

Permalink
SPC-108 Update IResourceController function names
Browse files Browse the repository at this point in the history
  • Loading branch information
tomeksabala committed Jul 4, 2023
1 parent 46c7d75 commit 596eeab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
4 changes: 2 additions & 2 deletions ckanext/spectrum/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ def dataset_facets(self, facet_dict, package_type):
return new_fd

# IResourceController
def before_create(self, context, resource):
def before_resource_create(self, context, resource):
spectrum_upload.handle_giftless_uploads(context, resource)
return resource

def before_update(self, context, current, resource):
def before_resource_update(self, context, current, resource):
spectrum_upload.handle_giftless_uploads(context, resource, current=current)
return resource

Expand Down
15 changes: 2 additions & 13 deletions ckanext/spectrum/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,8 @@ def add_activity(context, data_dict, activity_type):


def handle_giftless_uploads(context, resource, current=None):

if _data_dict_is_resource(resource):
_giftless_upload(context, resource, current=current)
_update_resource_last_modified_date(resource, current=current)


def _data_dict_is_resource(data_dict):
return not (
u'creator_user_id' in data_dict
or u'owner_org' in data_dict
or u'resources' in data_dict
or data_dict.get(u'type') == u'dataset'
)
_giftless_upload(context, resource, current=current)
_update_resource_last_modified_date(resource, current=current)


def _giftless_upload(context, resource, current=None):
Expand Down

0 comments on commit 596eeab

Please sign in to comment.