diff --git a/news/116.bugfix b/news/116.bugfix new file mode 100644 index 00000000..b062ffc2 --- /dev/null +++ b/news/116.bugfix @@ -0,0 +1,5 @@ +Performance enhancement: +Refine pre-filtering of attributes on content ``__getattr__``. +Filter out all permissions (ending with ``_Permission``) and some portal-tools. +Also often called aquired functions are skipped. +[jensens] \ No newline at end of file diff --git a/plone/dexterity/content.py b/plone/dexterity/content.py index c177aa61..5e83ad78 100644 --- a/plone/dexterity/content.py +++ b/plone/dexterity/content.py @@ -58,10 +58,16 @@ # see comment in DexterityContent.__getattr__ method ATTRIBUTE_NAMES_TO_IGNORE = ( - '_v__providedBy__', - 'im_self', # python 2 only, on python 3 it was renamed to __self__ + '_dav_writelocks', 'aq_inner', - '_Access_contents_information_Permission' + 'getCurrentSkinName', + 'getURL', + 'im_self', # python 2 only, on python 3 it was renamed to __self__ + 'plone_utils', + 'portal_membership', + 'portal_placeful_workflow', + 'portal_properties', + 'translation_service', ) @@ -340,8 +346,13 @@ def __getattr__(self, name): # defined). # also handle special dynamic providedBy cache here. # Ignore also some other well known names like - # Acquisition and AccessControl related ones. - if name.startswith('__') or name in ATTRIBUTE_NAMES_TO_IGNORE: + # Permission, Acquisition and AccessControl related ones. + if ( + name.startswith('__') + or name.startswith('_v') + or name.endswith('_Permission') + or name in ATTRIBUTE_NAMES_TO_IGNORE + ): raise AttributeError(name) # attribute was not found; try to look it up in the schema and return