[Zope-CMF] SkinTools optimisation

Johan Carlsson [EasyPublisher] johanc@easypublisher.com
Mon, 14 Apr 2003 21:10:44 +0000


At 15:20 2003-04-14 -0400, Shane Hathaway said:
>Johan Carlsson [EasyPublisher] wrote:
>>Hi,
>>I'm not sure if this is an issue for zope-cmf or zope-dev,
>>correct me if I'm wrong.
>>I about to implement a SkinnableObjectManager and I as I understand it
>>the SkinnableObjectManager setus up a self._v_skindata for each object
>>supporting the SkinnableObjectManager when it is traversed?
>>This have the implication that if the traverse path of the URL is very long,
>>e.g. the object is deep in the hierarchy of the ZODB it will use more
>>time to calculate each _v_skindata.
>>I would suggest solving this by implementing a lazy _v_skindata that stores
>>the path, object path and skin name (for instance) and can be use from
>>the __getattr__ when ever an actually _v_skindata is needed.
>>Am I missing something how it's implemented?
>>Is this a good or bad idea?
>
>There is only one SkinnableObjectManager--it's the CMF site object. Only 
>folders that directly contain a "portal_skins" tool need to be 
>SkinnableObjectManagers.  The _v_skindata attribute is set up as lazily as 
>possible already, since it's computed only once per request, and every 
>request needs it.  You could optimize it in C.

Aha. Not the way I'm using it :-)
(I'm not always thing in the same line as CMF was intended)

I probably override setupCurrentSkin to set it up more lazy (just saving 
the path and some other meta data)
which would work better in my use cases.


>FWIW, the proposal linked below mentions one way the skinning machinery 
>could be transformed.  It would eliminate __getattr__(), _v_skindata, and 
>all the other skin magic.  This is more than what you asked for, and I 
>don't know whether the proposal will be accepted, but I wanted to give you 
>a better answer than just "write C code instead." :-)
>
>http://dev.zope.org/Zope3/NamespacesInTemplates

Interesting, I'll have a look. Thanks.

Best Regards,
Johan Carlsson



-- 
Easy Publisher Developers Team
Johan Carlsson
johanc@easypublisher.com

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Phone +46-(0)8-31 24 94
Fax +46-(0)8-673 04 44
Mobil +46-(0)70-558 25 24
http://www.easypublisher.com