Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API naming conflict across different route prefixes #1

Open
kdeininger opened this issue Jan 3, 2017 · 0 comments
Open

API naming conflict across different route prefixes #1

kdeininger opened this issue Jan 3, 2017 · 0 comments

Comments

@kdeininger
Copy link
Contributor

Creating two APIs with the same name but different route prefixes should be possible. But this doesn't work because only the name is written to the registry:
https://github.com/vvmruder/pyramid_georest/blob/master/pyramid_georest/lib/rest.py#L846-L855

Suggested fix:
Write the combination of config.route_prefix and the API name to the registry. For example:

reg_name = urlparse.urljoin(config.route_prefix, name)
if reg_name not in config.registry.pyramid_georest_apis:
    config.registry.pyramid_georest_apis[reg_name] = self
    config.commit()
    create_api_routing(config, self)
else:
    log.error(
        "The Api-Object you created seems to already exist in the registry. It has to be unique at all. "
        "Couldn't be added. Sorry..."
    )
    raise LookupError()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant