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

Restore the Registry(*args, **kw) API #2916

Closed
tlotze opened this issue Jan 24, 2017 · 5 comments · Fixed by #2917
Closed

Restore the Registry(*args, **kw) API #2916

tlotze opened this issue Jan 24, 2017 · 5 comments · Fixed by #2917
Assignees

Comments

@tlotze
Copy link

tlotze commented Jan 24, 2017

In the course of #2891, the Registry API was changed in a backwards-incompatible way. While the author of the change (PR 2893) couldn't imagine anyone using the keywords API, I immediately ran into the incompatibility with a number of customer projects. Since the change back to the old API shouldn't introduce another backwards incompatibility, I suggest reverting that change as soon as possible.

@digitalresistor
Copy link
Member

How were you using the API?

@mmerickel
Copy link
Member

It looks like you can configure the registry to delegate lookup to another registry (probably the global one). I will patch this for 1.8.1. I should have done more research on what the bases argument was prior to removing it.

https://github.com/zopefoundation/zope.interface/blob/b8a36f1b6aa2c4d4470c08b84bb6f5031e33ab30/src/zope/interface/registry.py#L180

https://docs.zope.org/zope.component/api/utility.html#delegated-utility-lookup

@tlotze
Copy link
Author

tlotze commented Jan 24, 2017

I'm using code like this to make Pyramid use the global ZCA registry:

        registry = pyramid.registry.Registry(
            bases=(zope.component.getGlobalSiteManager(),))
        config = pyramid.config.Configurator(
            settings=self.settings,
            registry=registry)
        config.setup_registry(settings=self.settings)

There are documented ways to do something similiar without using the bases parameter, but I'm not aware of another way to have Pyramid use a registry that delegates, but is not identical, to the same ZCA global registry that has been in use during process start-up before Pyramid came into play, while being a full pyramid.registry.Registry (as opposed to a zope.interface.registry.Component, which the Pyramid registry expands upon).

In addition to this technical reason for wanting the bases parameter back, I consider it a matter of principle that a backwards-incompatible change like this should not go into a release without some research (and without even being documented in the change log). I'm happy to see that we agree on that, so I'd like to reinforce my suggestion to just restore the old *arg, **kw API in 1.8.1 and bring up simplification as a feature for a future release, so it may be discussed by the users of the API.

@tlotze
Copy link
Author

tlotze commented Jan 25, 2017

Thank you!

@russellballestrini
Copy link
Contributor

@mmerickel you rock, thank you for resolving this so quickly.

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

Successfully merging a pull request may close this issue.

4 participants