[ZODB-Dev] Using Ape to map zclass property sheets

Rocky Burt rocky.burt at bricsnet.com
Tue May 13 15:41:04 EDT 2003


Well, I'm trying to get the propertysheets attribute on a ZClass
instance to be mapped the same way as a folder's items gets mapped. 
I've gotten the mapper back and am modifying it... here's some code
snippets I used.


    # classes_makeup contains information on folderish zclasses
    folder_items_serializer = apeOfsserial.FolderItemsByKeychain()
    folder_items_gw = apeStructure.SQLFolderItems(conn)
    base_p_ser = root_mapper.getSubMapper('base_p').getSerializer()
    base_p = root_mapper.getSubMapper('base_p').getGateway()
    cfr = root_mapper.getClassifier()
    for class_name, class_value in classes_makeup.items():
        log('registered meta_type [%s]' % class_name)
        m = root_mapper.addSubMapper(class_name)
        cs = apeSerializers.AnyObjectSerializer(base_p_ser)
        cs.addSerializer('items', folder_items_serializer)
        m.setSerializer(cs)
        cfr.register(class_name, class_name)
        
        g = apeGateways.CompositeGateway(base_p)
        g.addGateway('items', folder_items_gw)
        root_mapper.getSubMapper(class_name).setGateway(g)

        cs.addSerializer('propertysheets', folder_items_serializer)
        g.addGateway('propertysheets', folder_items_gw)


As an example, I have a Project class.  The project class is getting its
classification properly set in the zodb_classification table (its saying
'Project' instead of '(any folder)').

But, I would expect my propertysheets to get mapped to the
zodb_folder_items table.  This isn't happening.  It appears as though
what I'm trying to do with propertysheets above is having no affect
whatsoever.

Anychance someone can point out something that I'm blatantly doing
wrong?

- Rocky




More information about the ZODB-Dev mailing list