Commit 400de71c authored by Ayush Tiwari's avatar Ayush Tiwari

erp5_catalog: Update properties for ERP5Catalog object with same values as SQLCatalog objects

parent 92f42a9b
......@@ -34,6 +34,7 @@ from Products.ERP5Type.Cache import caching_instance_method
from Products.ERP5Type.Cache import CachingMethod, CacheCookieMixin
from Products.ERP5Type.ERP5Type import ERP5TypeInformation
from Products.ERP5Type.Log import log as unrestrictedLog
from Products.ERP5Type.Utils import UpperCase
from Products.CMFActivity.Errors import ActivityPendingError
import ERP5Defaults
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
......@@ -1755,6 +1756,24 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
property_type = sql_catalog.getPropertyType(property_id)
erp5_catalog.setProperty(key=property_id, value=value, type=property_type)
# This step is required as we don't have consistency between the properties
# of new ERP5Catalog object and SQLCatalog.Catalog objects, i.e,
# for example: Trying to get property `sql_catalog_clear_reserved` for
# `erp5_catalog` would give us a tuple cause it is basically calling the
# getter function getSqlCatalogClearReserved, which when called for
# `sql_catalog.sql_catalog_clear_reserved` would give a string.
# This inconsistency arised due to the generation of getter functions where
# 'selection' type is taken as list_types which leads to creating getters
# and setters accordingly to create list and tuples instead of just a
# string. Well, imo(Ayush), this might not be good way to solve this
# problem. Other way would be to leave the proeprties as it is for ERP5Catalog
# objects and change the function calls in ERP5Catalog accordignly instead.
for p in sql_catalog.propertyMap():
if p['type'] == 'selection':
accessor_name = 'get' + UpperCase(p['id'])
value = getattr(sql_catalog, p['id'])
setattr(erp5_catalog, p['id'], value)
Globals.InitializeClass(ERP5Site)
def getBootstrapDirectory():
......
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