Fixed a bug in malthes rewrite of the schema cache, since invalidate on the schema cache can be invoked for a non-registered FTI, which caused an error, furthermore invalidate schema was called for an unregistered FTI, which was definitely also a mistake.
This commit is contained in:
parent
75d2b6dd5d
commit
412e370d28
|
@ -367,11 +367,11 @@ def unregister(fti, old_name=None):
|
|||
site_manager = getSiteManager(site)
|
||||
|
||||
portal_type = old_name or fti.getId()
|
||||
|
||||
notify(SchemaInvalidatedEvent(portal_type))
|
||||
|
||||
site_manager.unregisterUtility(provided=IDexterityFTI, name=portal_type)
|
||||
unregister_factory(fti.factory, site_manager)
|
||||
|
||||
notify(SchemaInvalidatedEvent(portal_type))
|
||||
unregister_factory(fti.factory, site_manager)
|
||||
|
||||
def unregister_factory(factory_name, site_manager):
|
||||
"""Helper method to unregister factories when unused by any dexterity
|
||||
|
@ -465,4 +465,4 @@ def ftiModified(object, event):
|
|||
model = fti.lookupModel()
|
||||
syncSchema(model.schema, schema, overwrite=True)
|
||||
|
||||
notify(SchemaInvalidatedEvent(portal_type))
|
||||
notify(SchemaInvalidatedEvent(portal_type))
|
||||
|
|
|
@ -115,7 +115,8 @@ class SchemaCache(object):
|
|||
@synchronized(lock)
|
||||
def invalidate(self, portal_type):
|
||||
fti = queryUtility(IDexterityFTI, name=portal_type)
|
||||
invalidate_cache(fti)
|
||||
if fti is not None:
|
||||
invalidate_cache(fti)
|
||||
|
||||
|
||||
SCHEMA_CACHE = SchemaCache()
|
||||
|
|
Reference in New Issue