Dnia piątek, 23 marca 2007 03:15, Stephan Richter napisał:
> >         If so I'll be glad to see any introduction or code example of how
> > to use this package. I'm a bit lost after reading baseregistry's doctests.
> Can you be more specific? I think you can get the gist of things by looking 
> the ZCML snippets in the main README.txt file and how to register a base 
> registry in the browser/README.txt file.
I read these but I must have missed something, because I can't get my code to 
Below are the details. What I try to accomplish is to define default skin for 
my local site instead of global overrides.zcml.

Simplified structure of files in the filesystem:

                 |- site.py
                 |- configure.zcml
                 |- overrides.zcml

What I did:
1. I created custom registry instance (site.py - file where my local site is 

   from z3c.baseregistry import baseregistry
   import zope.component
   custom = 
baseregistry.BaseComponents(zope.component.globalSiteManager, 'custom')

2. registered my custom registry (configure.zcml):

        name="custom" />

3. set my local site __bases__ (site.py):

def setSiteManagerWhenAdded(site, event):

    sm = site.getSiteManager()

    custom = zope.component.getUtility(IComponents, name='custom')
    sm.__bases__ += (custom,)

    bases = list(sm.__bases__)
    sm.__bases__ = bases

    #what is sm.__bases__ ?
    print sm.__bases__ 
    #it prints: [<BaseComponents custom>, <LocalSiteManager ++etc++site>]

4. placed my_product-overrides.zcml in instance's package-includes:

<include package="my_product" file="override.zcml" />

5. placed override.zcml in my_product's root folder:

   <registerIn registry=".site.custom">
    <browser:defaultSkin name="MyProductSkin" />

There are no errors when I start my Z3 instance, but the above defaultSkin 
directive is ignored. What is wrong here?

Jakub Wisniowski
Zope3-users mailing list

Reply via email to