[Product-Developers] paster, AnnotationStorage and the daily cup of ...

Mikko Ohtamaa mikko+plone at redinnovation.com
Sat Sep 19 08:42:37 UTC 2009


Hi,

Paster archetype template seem to set AnnotationStorage for title and
description by default.

    VariantProductSchema['title'].storage = atapi.AnnotationStorage()
    VariantProductSchema['description'].storage = atapi.AnnotationStorage()
    
    schemata.finalizeATCTSchema(
        VariantProductSchema,
        folderish=True,
        moveDiscussion=False
    )
    
    class VariantProduct(folder.ATFolder):
        """ Buyable physical good with variants of title and price and
multiple images """
        implements(IVariantProduct,
                  Products.PloneGetPaid.interfaces.IShippableMarker)
    
        meta_type = "VariantProduct"
        schema = VariantProductSchema
    
        title = atapi.ATFieldProperty('title')
        description = atapi.ATFieldProperty('description')

I just checked from AT code and AnnotationStorage uses OOBTree object
context.__annotations__ as storage backend.

What I have learnt from Zope world is that objects loaded from OOBTree need
extra database lookup. This is correct right?

Because title and description are read almost always when the object is
being accessed isn't this ineffective? If we open a page for viewing AT
object created by paster we'd have to do three different database look-ups
instead of one?
    
    Load object
    Load title for the object from annotations
    Load description for the object from annoations
    etc..

If we used AttributeStorage this would be:

    Load object (and get title and description on the same fetch)

Have I understood everything involved here?

-- 
View this message in context: http://n2.nabble.com/paster-AnnotationStorage-and-the-daily-cup-of-tp3674475p3674475.html
Sent from the Product Developers mailing list archive at Nabble.com.




More information about the Product-Developers mailing list