Cornices/cornice

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

Opened this issue · 4 comments

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 #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

I will follow the masses here :)

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

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.

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.

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.