Beispiel #1
0
def add_laser_util(argv=None):
    resource_args = add_laser_parser().parse_args(argv)
    resource = util_add.create_parsed_resource(resource_args, 
            meta_parser=argparse.ArgumentParser(parents=[
                util_add._bdkd_metadata_parser(),
                _laser_metadata_parser(),
                ]), 
            argv=argv)
    _laser_metadata_raw(resource)
    _laser_metadata_maps(resource)
    _laser_readme(resource)
    Dataset.validate(resource)
    util_add._save_resource(resource_args.repository, resource)
Beispiel #2
0
def add_laser_util(argv=None):
    resource_args = add_laser_parser().parse_args(argv)
    resource = util_add.create_parsed_resource(
        resource_args,
        meta_parser=argparse.ArgumentParser(parents=[
            util_add._bdkd_metadata_parser(),
            _laser_metadata_parser(),
        ]),
        argv=argv)
    _laser_metadata_raw(resource)
    _laser_metadata_maps(resource)
    _laser_readme(resource)
    Dataset.validate(resource)
    util_add._save_resource(resource_args.repository, resource)
Beispiel #3
0
    def wrapper(*args, **kwargs):
        if 'repository_name' in kwargs and 'dataset_name' in kwargs:
            try:
                kwargs['dataset_name'] = urllib.unquote_plus(
                        kwargs['dataset_name'])
                dataset = Dataset.open(kwargs['repository_name'], 
                        kwargs['dataset_name'])
                if not dataset:
                    abort(404)
            except ValueError:
                return redirect('/static/unsupported.html')

            kwargs['dataset'] = dataset
            if 'map_name' in kwargs:
                if not kwargs['map_name'] in dataset.get_map_names():
                    abort(404)
            return f(*args, **kwargs)
        else:
            abort(400)
Beispiel #4
0
def get_datasets(repository_name):
    dataset_names = Dataset.list(repository_name, None)
    if not dataset_names:
        abort(404)
    return json.dumps(dataset_names)