[CMF-checkins] CVS: CMF - Skinnable.py:1.2
shane@digicool.com
shane@digicool.com
Sat, 7 Apr 2001 19:09:10 -0400 (EDT)
Update of /cvs-repository/CMF/CMFCore
In directory korak:/tmp/cvs-serv8589
Modified Files:
Skinnable.py
Log Message:
Optimization: things that aren't found are extremely unlikely to be
found later within the same request. Should speed up skins
somewhat.
--- Updated File Skinnable.py in package CMF --
--- Skinnable.py 2001/02/23 14:24:11 1.1
+++ Skinnable.py 2001/04/07 23:09:08 1.2
@@ -129,13 +129,16 @@
if name[:1] != '_' and name[:3] != 'aq_':
sd = self._v_skindata
if sd is not None:
- ob = sd[0]
- subob = getattr(ob, name, _marker)
- if subob is not _marker:
- # Return it in context of self, forgetting
- # its location and acting as if it were located
- # in self.
- return aq_base(subob)
+ ob, ignore = sd
+ if not ignore.has_key(name):
+ subob = getattr(ob, name, _marker)
+ if subob is not _marker:
+ # Return it in context of self, forgetting
+ # its location and acting as if it were located
+ # in self.
+ return aq_base(subob)
+ else:
+ ignore[name] = 1
return superGetAttr(self, name)
security.declarePublic('setupCurrentSkin')
@@ -149,7 +152,8 @@
REQUEST = getattr(self, 'REQUEST', None)
if REQUEST is None:
# We are traversing without a REQUEST at the root.
- # Don't change the skin right now.
+ # Don't change the skin right now. (Otherwise
+ # [un]restrictedTraverse messes up the skin data.)
return
self._v_skindata = None
sfn = self.getSkinsFolderName()
@@ -161,7 +165,7 @@
sd = sf.getSkin(REQUEST)
if sd is not None:
# Hide from acquisition.
- self._v_skindata = (sd,)
+ self._v_skindata = (sd, {})
def __of__(self, parent):
'''