Esempio n. 1
0
    def add_hint(self):
        pkg = request.params['pkg']
        resource_id = request.params['resource_id']
        prev_resource_id = request.params['prev_resource_id']
        hint = request.params['hint']

        p = ckan.Package(pkg)

        if prev_resource_id != '' and prev_resource_id != resource_id:
            p.remove_hint(prev_resource_id)

        p.add_hint(resource_id, hint)

        redirect(url(request.referer))
Esempio n. 2
0
    def drop_database(self):
        c.job_id = 'drop_database'

        if daemon.job_running(c.job_id):
            return render('task/drop_database.html')

        daemon.dispatch_job(
            job_id=c.job_id,
            config=config['__file__'],
            task='drop_collections'
        )
        return redirect(url(controller='job', action='status', job_id=c.job_id))
Esempio n. 3
0
    def remove_dataset(self, dataset=None):
        if dataset is None:
            c.datasets = model.Dataset.find()
            return render('task/remove_dataset.html')

        c.job_id = 'remove_%s' % dataset
        c.job_running = daemon.job_running(c.job_id)

        if c.job_running:
            return render('task/remove_dataset.html')

        daemon.dispatch_job(
            job_id=c.job_id,
            config=config['__file__'],
            task='remove_dataset',
            args=(dataset,)
        )
        return redirect(url(controller='job', action='status', job_id=c.job_id))
Esempio n. 4
0
    def start(self, package):
        job_id = _job_id_for_package(package)

        if daemon.job_running(job_id):
            c.pkg_name = package
            c.job_id = job_id
            return render('load/start.html')
        else:
            daemon.dispatch_job(
                job_id=job_id,
                config=config['__file__'],
                task='ckan_import',
                args=(package,)
            )
            return redirect(url(
                controller='job',
                action='status',
                job_id=job_id
            ))