def post(self, item): dataset = get_dataset(current_app.commands.crawler, item.name) dataset_dir = path.abspath(path.dirname(dataset._path)) if request.values['copy'] == u'true': op = copy else: op = move new_path = path.join(dataset_dir, request.values['name']) op(dataset._path, path.join(dataset_dir, request.values['name'])) dataset = get_dataset(current_app.commands.crawler, request.values['name']) for key in dataset.keys(): dataset[key]._path = new_path dataset.save()
def put(self, tree): '''create new dataset''' dataset = get_dataset(current_app.commands.crawler, request.values['name']) dataset.save() return ('tree/children.xml', {})
def put(self, item): '''create new datasource''' dataset = get_dataset(current_app.commands.crawler, item.name) item.obj[request.values['name']] \ = current_app.commands.crawler\ .datasources[request.values['type']](dataset._path) item.obj.save(dataset._path) return ('tree/children.xml', {})