From 017a3e2307b042a473a1a2425e6e8c8472aa7d33 Mon Sep 17 00:00:00 2001 From: Arnaud Fontaine <arnaud.fontaine@nexedi.com> Date: Tue, 2 Apr 2013 15:15:27 +0900 Subject: [PATCH] Automatic migration to ZODB Property Sheets failed because of Folder generateNewId() calling getIdGenerator() accessor which not available yet, thus define a dummy accessor so that erp5_property_sheets can be installed. --- product/ERP5Type/Core/Folder.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/product/ERP5Type/Core/Folder.py b/product/ERP5Type/Core/Folder.py index 177688b092..b74251322a 100644 --- a/product/ERP5Type/Core/Folder.py +++ b/product/ERP5Type/Core/Folder.py @@ -46,6 +46,7 @@ from Products.ERP5Type.XMLExportImport import Folder_asXML from Products.ERP5Type.Utils import sortValueList from Products.ERP5Type import Permissions from Products.ERP5Type.Globals import InitializeClass +from Products.ERP5Type.Accessor import Base as BaseAccessor try: from Products.CMFCore.CMFBTreeFolder import CMFBTreeFolder @@ -246,6 +247,17 @@ class FolderMixIn(ExtensionClass.Base): my_id = self._generateRandomId() return "%s.%03d-%s" %(current_date, node_number, my_id) + # Getter defines to address migration of a site to ZODB Property Sheets, + # otherwise installing erp5_property_sheets fails in generateNewId() as + # getIdGenerator accessor does not exist yet + getIdGenerator = BaseAccessor.Getter('getIdGenerator', 'id_generator', + 'string', default='') + + getLastId = BaseAccessor.Getter('getLastId', 'last_id', 'string', + default='0') + + _setLastId = BaseAccessor.Setter('_setLastId', 'last_id', 'string') + # Automatic ID Generation method security.declareProtected(Permissions.View, 'generateNewId') def generateNewId(self,id_group=None,default=None,method=None): -- 2.30.9