Commit 49f3a8be authored by Arnaud Fontaine's avatar Arnaud Fontaine

When loading the Portal Type, check whether portal_property_sheets is

not missing, which may arise when the BT has not been upgraded yet


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41192 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent be5b3004
......@@ -220,13 +220,18 @@ def generatePortalTypeClass(portal_type_name):
property_sheet_generating_portal_type_set.add(portal_type_name)
property_sheet_tool = getattr(site, 'portal_property_sheets', None)
property_sheet_set = set()
# The Property Sheet Tool may be None if the code is updated but
# the BT has not been upgraded yet with portal_property_sheets
if property_sheet_tool is not None:
if portal_type is not None:
# Get the Property Sheets defined on the portal_type and use the
# ZODB Property Sheet rather than the filesystem only if it
# exists in ZODB
zodb_property_sheet_set = set(site.portal_property_sheets.objectIds())
zodb_property_sheet_set = set(property_sheet_tool.objectIds())
for property_sheet in portal_type.getTypePropertySheetList():
if property_sheet in zodb_property_sheet_set:
property_sheet_set.add(property_sheet)
......@@ -251,10 +256,10 @@ def generatePortalTypeClass(portal_type_name):
# Initialize ZODB Property Sheets accessor holders
_fillAccessorHolderList(
accessor_holder_list,
site.portal_property_sheets.createZodbPropertySheetAccessorHolder,
property_sheet_tool.createZodbPropertySheetAccessorHolder,
property_sheet_set,
erp5.accessor_holder,
site.portal_property_sheets)
property_sheet_tool)
property_sheet_generating_portal_type_set.remove(portal_type_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