From 0f2efaf3dde44c497bcf40163afe988fa08d0470 Mon Sep 17 00:00:00 2001 From: Ivan Tyagov <ivan@nexedi.com> Date: Wed, 27 Jun 2012 14:27:04 +0000 Subject: [PATCH] Do not log messages for every call of security calculation (one per transaction). Try to support migration of old instances (containing old erp5_property_sheets) with recent products. This is especially visible with BusinessTemplate property sheet when new filesystem versions require an up to date erp5_property_sheets bt5 which itself can not be installed. --- product/ERP5/Document/BusinessTemplate.py | 14 ++++++++++++-- product/ERP5Catalog/CatalogTool.py | 3 +-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py index 3726617141..b45622c038 100644 --- a/product/ERP5/Document/BusinessTemplate.py +++ b/product/ERP5/Document/BusinessTemplate.py @@ -4968,9 +4968,14 @@ Business Template is a set of definitions, such as skins, portal types and categ self._catalog_local_role_key_item = \ CatalogLocalRoleKeyTemplateItem( self.getTemplateCatalogLocalRoleKeyList()) - self._catalog_security_uid_column_item = \ + try: + self._catalog_security_uid_column_item = \ CatalogSecurityUidColumnTemplateItem( self.getTemplateCatalogSecurityUidColumnList()) + except AttributeError: + # be backwards compatible with old zope instances which + # do not contain recent version of erp5_property_sheets + pass security.declareProtected(Permissions.ManagePortal, 'build') def build(self, no_action=0): @@ -5584,7 +5589,12 @@ Business Template is a set of definitions, such as skins, portal types and categ (SimpleItem.SimpleItem,), {'__module__': module_id})) for item_name in self._item_name_list: - getattr(self, item_name).importFile(bta) + item_object = getattr(self, item_name) + # this check is due to backwards compatability when there can be a + # difference between install erp5_property_sheets (esp. BusinessTemplate + # property sheet) + if item_object is not None: + item_object.importFile(bta) # Remove temporary modules created above to allow import of real modules # (during the installation). diff --git a/product/ERP5Catalog/CatalogTool.py b/product/ERP5Catalog/CatalogTool.py index e8e3e2e703..3e15e1720d 100644 --- a/product/ERP5Catalog/CatalogTool.py +++ b/product/ERP5Catalog/CatalogTool.py @@ -515,8 +515,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): try: local_roles_group_id = brain.local_roles_group_id except AttributeError: - LOG("ERP5Catalog", PROBLEM, - "sql_search_security is not up to date, falling back.") + # backwards compatability in cases when catalog use default schema local_roles_group_id = '' security_uid_dict.setdefault(local_roles_group_id, []).append(brain.uid) -- 2.30.9