From 81bc7feda0e3eec8cd2b8d8a1e7ddafdbd5b9036 Mon Sep 17 00:00:00 2001 From: Arnaud Fontaine <arnaud.fontaine@nexedi.com> Date: Tue, 15 Feb 2011 14:04:45 +0000 Subject: [PATCH] Accessor generation used to first generate accessors for properties, *then* accessors for categories only if the latter accessors have not been defined by the former (by using 'hasattr'). As the 'hasattr'es have been removed, the reverse operation is performed to maintain backward-compatibility git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43352 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/Core/PropertySheet.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/product/ERP5Type/Core/PropertySheet.py b/product/ERP5Type/Core/PropertySheet.py index da572e826d..2f0aff9ee6 100644 --- a/product/ERP5Type/Core/PropertySheet.py +++ b/product/ERP5Type/Core/PropertySheet.py @@ -217,5 +217,19 @@ class PropertySheet(Folder): security.declareProtected(Permissions.AccessContentsInformation, 'applyOnAccessorHolder') def applyOnAccessorHolder(self, accessor_holder, expression_context, portal): - for property in self.contentValues(): - property.applyOnAccessorHolder(accessor_holder, expression_context, portal) + # Accessor generation used to first generate accessors for + # properties, *then* accessors for categories only if the latter + # accessors have not been defined by the former (by using + # 'hasattr'). As the 'hasattr'es have been removed, the reverse + # operation is performed to maintain backward-compatibility + property_definition_list = [] + for property_definition in self.contentValues(): + if property_definition.getPortalType().endswith('Category Property'): + property_definition_list.insert(0, property_definition) + else: + property_definition_list.append(property_definition) + + for property_definition in property_definition_list: + property_definition.applyOnAccessorHolder(accessor_holder, + expression_context, + portal) -- 2.30.9