I'm currently building a photo management application for which I need
to setup local utilities (a catalog...), so I want to make a site of my
main folder, which is called a gallery.
My current problem is that I can't define the folder as a site manager
if it is subclassed from BTreeContainer ; the same code that follows
works perfectly if my Gallery class just inherits from Folder.
Here is the main structure of my code, mainly extracted from the "cubic"
portal :

        class IGalleryContainer (IContainer):
            """Marker interface"""
        class IGalleryFolder (IGalleryContainer):
            """Photo management folder"""
            def __setitem__ (name, object):
                """Add a new sub-folder"""
            __setitem__.precondition = 
        class IGallery (IGalleryFolder):
            """Marker interface"""
        class GalleryFolder (BTreeContainer):
            """Photo management folder"""
            implements (IGalleryFolder)
        class Gallery (GalleryFolder, SiteManagerContainer):
            """Main gallery site"""
            implements (IGallery)
            def setupSiteManager(self):
                """Setup a sitemanager and related utilities
                Invoked through the setupGallery handler
                default = self.getSiteManager()['default']
                reg_manager = default.registrationManager
                if 'intid' not in default:
                    intids = IntIds()
                    default['intid'] = intids
                    intids_reg = UtilityRegistration('', IIntIds, intids)
                    intids_reg.status = ActiveStatus
                if 'catalog' not in default:
                    catalog = Catalog()
                    default['catalog'] = catalog
                    catalog_reg = UtilityRegistration('catalog', ICatalog, 
                    catalog_reg.status = ActiveStatus
                catalog = default['catalog']
                index = SetIndex(field_name='getPathElements', 
interface=IPathElements, field_callable=True)
                catalog['path'] = index

In fact, at the end of the "setupSiteManager" method, which is called
through an event subscriber, "zapi.getPath(default)" returns the correct
path (/mygallery/++etc++site/default) and the gallery folder is
correctly marked as being a site in introspector. No exception is raised
while setting the site, but any try to follow the "Site management" link
returns an error, and the ++etc++site "sub-folder" seems to be
vanished !
The same problem appears if I don't call the "setupSiteManager" and try
to create the site through the "Make a site" link.

Thanks for any help,


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Zope3-users mailing list

Reply via email to