Commit 735d4748 authored by Vincent Pelletier's avatar Vincent Pelletier

ERP5Type.Core.Folder: Do not try to access subobjects with invalid names.

This improves performance when unset protected properties are being
accessed.
parent e8856a5e
......@@ -966,6 +966,12 @@ class Folder(CopyContainer, OFSFolder2, CMFBTreeFolder, CMFHBTreeFolder, Base, F
return self._getFolderHandlerData()[2].generateId(self, prefix, suffix, rand_ceiling)
def __getattr__(self, name):
# Subobject ids are forbidden to start with an underscore.
# This saves time by not even attempting traversal when not needed,
# for example when AccessControl.users.BasicUser._check_context checks
# whether given object is a bound function.
if name.startswith('_'):
raise AttributeError(name)
property_id, _, folder = self._getFolderHandlerData()
if getattr(self, property_id) is None:
raise AttributeError(name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment