def command(self): self._load_config() cmd = self.args[0] if cmd == "import": from ckanext.ngds.importer.importer import BulkUploader bulkLoader = BulkUploader() bulkLoader.execute_bulk_upload() elif cmd == "doc-index": from ckanext.ngds.ngdsui.misc.helpers import process_resource_docs_to_index process_resource_docs_to_index() elif cmd == "compile_client_scripts": from ckanext.ngds.lib.compile_client_scripts.script_compiler import ScriptCompiler import ckanext.ngds.ngdsui as uimodule print ScriptCompiler uipath = os.path.dirname(os.path.abspath(uimodule.__file__)) sc = ScriptCompiler(uipath) sc.compile_less() sc.minify_js() elif cmd == "create_ngds_org": from ckanext.ngds.lib.customize.customize import Customize cust = Customize() cust.customize() else: print "Command %s not recognized" % cmd
""" context = { 'model': model, 'session': model.Session, 'user': c.user or c.author } try: check_access('execute_bulkupload', context, None) except NotAuthorized, error: abort(401, error.__str__()) from ckanext.ngds.importer.importer import BulkUploader bulkLoader = BulkUploader() bulkLoader.execute_bulk_upload() h.flash_notice(toolkit._( 'Initiated Bulk Upload process and it is running in the background.' ), allow_html=True) url = h.url_for( controller= 'ckanext.ngds.ngdsui.controllers.contribute:ContributeController', action='bulkupload_list') redirect(url) @jsonify def validate_resource(self): """ Validate a resource to ensure that it conforms to NGDS standards. For ex: if a resource specifies that it conforms to a content model, that validation occurs here.
def execute_bulkupload(self): """ Executes a bulk upload job. This function can only be triggered by an admin via the bulk upload page. """ context = {'model': model, 'session': model.Session, 'user': c.user or c.author} try: check_access('execute_bulkupload', context, None) except NotAuthorized, error: abort(401, error.__str__()) from ckanext.ngds.importer.importer import BulkUploader bulkLoader = BulkUploader() bulkLoader.execute_bulk_upload() h.flash_notice(toolkit._('Initiated Bulk Upload process and it is running in the background.'), allow_html=True) url = h.url_for(controller='ckanext.ngds.ngdsui.controllers.contribute:ContributeController', action='bulkupload_list') redirect(url) @jsonify def validate_resource(self): """ Validate a resource to ensure that it conforms to NGDS standards. For ex: if a resource specifies that it conforms to a content model, that validation occurs here. """ data = clean_dict(unflatten(tuplize_dict(parse_params( request.params)))) return toolkit.get_action("validate_resource")(None, data)