Thanks Michael.  That's the page that I had read.  Off the 3 options the 
one with the least possible side effects appears to be the one where you 
simply use the registry that pyramid generates and includes it to the 
request, which is what I'm pursuing at the moment.  

Does anybody know if there would be any side-effects if I had a 
config.hook_zca() statement in a 'includeme(config)' method if my pyramid 
app were to be used by another pyramid app?

Julian


On Wednesday, September 13, 2017 at 1:26:51 PM UTC-5, Michael Merickel 
wrote:
>
> 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 <forei...@gmail.com 
> <javascript:>> 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 pylons-discus...@googlegroups.com <javascript:>.
>> To post to this group, send email to pylons-...@googlegroups.com 
>> <javascript:>.
>> 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 pylons-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/f71b0057-c892-4f8d-9dd6-895360f68e0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to