[FIX] base: ir.model.data:call_cache_clearing_methods is tolerant to unknow objects

ir.ui.menu: remove __del__ method as this can forbid the python gc to break the pool cycle

bzr revid: chs@openerp.com-20110120160020-t1bfkpjgeqpa5vsw
This commit is contained in:
Christophe Simonis 2011-01-20 17:00:20 +01:00
parent 523f5c1f2a
commit 5b08fe4d6d
2 changed files with 3 additions and 5 deletions

View File

@ -531,7 +531,9 @@ class ir_model_access(osv.osv):
def call_cache_clearing_methods(self, cr):
self.check.clear_cache(cr.dbname) # clear the cache of check function
for model, method in self.__cache_clearing_methods:
getattr(self.pool.get(model), method)()
object_ = self.pool.get(model)
if object_:
getattr(object_, method)()
#
# Check rights on actions

View File

@ -44,10 +44,6 @@ class ir_ui_menu(osv.osv):
self.pool.get('ir.model.access').register_cache_clearing_method(self._name, 'clear_cache')
return r
def __del__(self):
self.pool.get('ir.model.access').unregister_cache_clearing_method(self._name, 'clear_cache')
return super(ir_ui_menu, self).__del__()
def clear_cache(self):
# radical but this doesn't frequently happen
self._cache = {}