My naive first take is just write a utility method:

def find_sitemanager(context):
    """
    Find nearest site manager, walking back up the tree from 'context'.
    """

Then, don't use the global API, but call getUtility and queryUtility on the
local registry that you find with your utility method.

Chris

On Mon, Oct 13, 2014 at 8:56 PM, Chris McDonough <[email protected]> wrote:

> On 10/13/2014 06:22 PM, Thierry Florac wrote:
>
>> Hi,
>>
>> I'm actually starting to study Pyramid.
>> My main goal is to be able to upgrade several quite huge applications
>> which are actually based on Zope 3 and heavily use the ZCA, without too
>> much rewriting.
>>
>> One of our main use case is to define "site managers" (or local
>> "component registries"), to be able to define utilities whose
>> definition, settings and registration are stored in the ZODB.
>> In Zope3, the process to get a given registered utility (with
>> "getUtility"/"queryUtility") is then straightforward and automatic, as
>> utilities lookup is done in context local registry before the global
>> registry.
>>
>> So I just have a simple question : is there an easy way with Pyramid to
>> make such a behaviour simple and automatic?
>> I already know how to create a local site manager, but how can I make
>> lookups as in Zope3 ??
>>
>> Thanks for any help...
>>
>
> I'm afraid you're pretty much on your own here.  Pyramid itself does not
> really support the concept of local registries, mostly because, unlike Zope
> 3, using ZODB (where those registries can be persisted easily) in Pyramid
> is not required.  I'm sure it can be achieved through some contortions, but
> I'm currently not very motivated to try to figured out what they are,
> apologies.
>
> - C
>
> --
> 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].
> Visit this group at http://groups.google.com/group/pylons-discuss.
> 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].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to