johnnoone / json-spec

Implements some tools for JSON

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

problem with FilesystemProvider resolving lookup in __get_item__

mdmiller53 opened this issue · comments

in __get_item__(), when the spec portion of the uri is obtained, the ':' is not stripped. this results in a key error on line 138: return self.data[spec]

@mdmiller53 can you give an example of breaking uri?

@johnnoone i defined the prefix like:
provider = FilesystemProvider(json_config['api_config_dir'], 'cur:config')

then the file i wanted to reference was named 'test_cohort_api.json'. the problem looks like it doesn't matter how the files are named, it's a one off error in:
spec = uri[len(self.prefix):]
len(self.prefix) is where the delimiter ':' will be in front of the file name prefix, so it is included in spec. that takes 'cur:config:test_cohort_api' and returns ':test_cohort_api' and causes the lookup in the map to fail. (i used aliases to work around this)

by the by, thanks for the package, it's been handy.