Skip to content
Snippets Groups Projects
Select Git revision
  • ea38c34aad22ccc63297163a04ebe61a2a3f29a3
  • main default protected
  • release
  • 0.21.0
  • 0.20.0
  • 0.19.0
  • 0.18.0
  • 0.17.0
  • 0.16.0
  • 0.15.0
  • 0.14.0
  • 0.13.0
  • 0.11.0
  • 0.10.0
  • 0.9.0
  • 0.8.0
  • 0.7.0
  • 0.6.0
  • 0.5.0
  • 0.4.2
  • 0.4.1
  • 0.4.0
  • 0.3.0
23 results

Jenkinsfile

Blame
  • enqueue.py 1.05 KiB
    #Note to change it to a background job, just this file would need to be be edited 
    #please look up the branch URL_Upload 
    
    from .thumbnail import create_thumbnail, create_thumbnail_for_last_resource
    import ckan.plugins.toolkit as toolkit
    
    def enqueue_after_create(context, resource):
        package = context.get('package')
        private = package.private
        
        # without the background job
        create_thumbnail(resource, private)
    
    def enqueue_after_update(context, resource):
        package = context.get('package')
        private = package.private
        package_id = package.id
        package = toolkit.get_action('package_show')(context, {'id':package_id})
        resources = package.get('resources')
        
        # without the background job
        create_thumbnail_for_last_resource(resources, private, package_id)
    
    def enqueue_after_delete(context, resources):
        package = context.get('package')
        private = package.private
        package_id = package.id
                
        # without the background job
        create_thumbnail_for_last_resource(resources, private, package_id)