I know almost nothing about what you just asked but I will point you to
https://docs.pylonsproject.org/projects/pyramid/en/1.9-branch/narr/zca.html#using-the-zca-global-api-in-a-pyramid-application
as well as the `config.hook_zca` method.

- Michael

On Wed, Sep 13, 2017 at 12:20 PM, Julian Sanchez <[email protected]>
wrote:

> After reading how to use the zca page I've managed to register a few
> utilities and adapters through
> request.registry.registerUtility(...)
> and
> request.registry.getUtility(...)
>
> How can you hook up the zope.component.createObject method?  I did my
> request.registry.registrerUtility(foo_factory, IFactory, 'Foo')
>
> but of course creatObject by itself will go against the global repository
> (and of course I get the dreaded 'could not adapt' error)
>
> I tried the trick:
> mycontext = zope.configuration.config.ConfigurationMachine()
> mycontext.registry = request.registry
>
>
> ..and then
> myfoo = createObject('Foo', context=mycontext)
>
> But that also returns 'could not adapt'
>
> Is my only option to do a
> request.registry.getUtility(IFactory, 'Foo')()
>
> instead of createObject?
>
> Thanks,
> Julian
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/pylons-discuss/46ff94d2-ef9e-4741-9d64-ae8e9e11cf8f%
> 40googlegroups.com
> <https://groups.google.com/d/msgid/pylons-discuss/46ff94d2-ef9e-4741-9d64-ae8e9e11cf8f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAKdhhwHDCKWQkE9Gxy30pj6Ohb3omhp5h8D71OHQbBotKit2Ag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to