Dieter Maurer wrote:
The function resetCaches() and self._resetCache() in ZODB.Connection
hasn't changed from zope 2.8 to zope 2.9.
Peter Bengtsson wrote at 2006-8-18 18:53 +0100:
One last odd clue, when I refresh my product (eg. MyProduct) in zope
2.9.4, actual something happens. My product is very very simple and
it's one main class has a method called index_html() that looks like
from DateTime import DateTime
def index_html(self, REQUEST, RESPONSE):
""" doc str """
It works fine. After I manually refresh the product through the
Control_Panel, I get an error in index_html() because now 'DateTime'
has become None and thus can't be called with DateTime().
Does that help you help me?
Global variables apparently becoming "None" is a sign
that you are using an old (pre refresh) version of a function
("index_html" in your case).
When a module is released, some Python magic arranges that
all its variables are rebound to "None".
When the function accesses one of its globals, it then appears as "None".
If you have accessed the "index_html" via a persistent instance,
then the "resetCaches" seems not to have done what we expect
(it should have caused the connection cache to be dropped and
a new instance loaded from the storage with the new class definition).
==== the code =========
global_reset_counter = 0
"""Causes all connection caches to be reset as connections are
Zope's refresh feature uses this. When you reload Python modules,
instances of classes continue to use the old class definitions.
To use the new code immediately, the refresh feature asks ZODB to
clear caches by calling resetCaches(). When the instances are
loaded by subsequent connections, they will use the new class
global_reset_counter += 1
class Connection(ExportImport, object):
"""Creates a new cache, discarding the old one.
See the docstring for the resetCaches() function.
self._reset_counter = global_reset_counter
cache_size = self._cache.cache_size
self._cache = cache = PickleCache(self, cache_size)
Zope maillist - Zope@zope.org
** No cross posts or HTML encoding! **
(Related lists -