Include a small comment on this optimization.

This commit is contained in:
Malthe Borch 2012-11-21 15:02:57 +01:00
parent e2fca426d9
commit 8b85633bfe
1 changed files with 6 additions and 3 deletions

View File

@ -177,12 +177,15 @@ class DexterityContent(DAVResourceMixin, PortalContent, DefaultDublinCoreImpl, C
description = u''
def __getattr__(self, name):
# attribute was not found; try to look it up in the schema and return
# a default
# optimization: sometimes we're asked for special attributes
# such as __conform__ that we can disregard (because we
# wouldn't be in here if the class had such an attribute
# defined).
if not name.startswith('__'):
raise AttributeError(name)
# attribute was not found; try to look it up in the schema and return
# a default
schema = SCHEMA_CACHE.get(self.portal_type)
if schema is not None:
field = schema.get(name, None)