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

@resource/@service decorated class as factory **autowired** or not **autowired**? #496

Open
wrkhenddher opened this issue Oct 23, 2018 · 4 comments

Comments

@wrkhenddher
Copy link

wrkhenddher commented Oct 23, 2018

Hello all,

Months ago (July 2017), there was a quick discussion about the autowiring factory feature incorporated by me in #456

@joesteeve, @joshuaimmanuel, @leplatrem, I (@wjehenddher)

#456 (comment)
#456 (comment)
#456 (comment)
#456 (comment)
#456 (comment)
#456 (comment)
#456 (comment)

There was no consensus but few alternatives were brought up:

  1. Remove the autowire (basically revert Aligning Cornice with Pyramid ACL pattern by auto-wiring factory to @resource/@service decorated class #456)

  2. Add a view config parameter to opt-in/opt-out autowiring the @resource/@service class as the root factory.

  3. Introduce a configuration that can globally enable/disable the autowiring feature. People who want it could enable it.

More Opinions?

More people have chimed in: @grant-humphries

@leplatrem
Copy link
Contributor

I will follow the masses here :)

If 1. is really bad, then revert. Otherwise introduce option (2.)

@joesteeve
Copy link
Contributor

Sorry for the late reply.

There is another option. We could introduce a configuration that can globally enable/disable the autowiring feature. People who want it could enable it.

@wrkhenddher
Copy link
Author

We could introduce a configuration that can globally enable/disable the autowiring feature. People who want it could enable it.

Adding to the possible options.

@grant-humphries
Copy link

There is another option. We could introduce a configuration that can globally enable/disable the autowiring feature. People who want it could enable it.

+1 for this ^, below are my comments on the topic from #456 (porting them here since this ticket has been designated as the place for further discussion):

...I am having similar issues to those raised in this thread as I am upgrading from version 1.0.0 to 3.5.1. We have have a bunch of existing services that are expecting the Pyramid root factory to be used as the factory for cornice resources when no factory parameter is passed to the decorator.

It seems like too much time has passed for reverting these changes to be an option, but I'm just looking for something to be present in the API that either allows me to set a default factory for all resources or a setting that indicates that the Pyramid root factory should be the default factory for all resources.

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

4 participants