[Zope] Zope 2.9 Product Refreshing

Peter Bengtsson peter at fry-it.com
Fri Aug 18 13:53:43 EDT 2006


> >>
> >> What happens when you try to refresh a product?
> >>
> >Nothing. No errors, no refresh.
>
> Then you should look in the SVN repository how the "refresh" code
> changed.
>
>    In Zope 2.8, refresh moves all modules starting with
>    "Products.<product_to_be_refreshed>" out of "sys.modules"
>    (and into a safe place) and then reimports the product.
>
>    If there is an exception, the saved modules are restored.
>    Otherwise, the ZODB is told to discard the connection cache
>    when the connection is opened for the next time.
>
> With this code, "no errors, no refresh" is impossible
> (you get either an error or a refesh).
No really. My last comment was a big ambiguous.
The Refresh tab of the Control_Panel is does say "Product refreshed.
(2006-08-18 18:33)"
But it actually fails. It gets more complicated...

>
> Of course, someone may have turned the refresh into a "noop".
> Then, you can try to reinstate the former code and see what
> happens.
>
I've now done a lot of searching and diffs on the difference between
some zope286 and some zope294 code.
The modules I've looked at are:
ZODB.Connection.resetCaches() - no difference
ZODB.Connection - BIG difference (but is it applicable?)
OFS.Application - instead of zLOG->logger, tiny difference in raise
App.RefreshFuncs - instead of zLOG->logger

I've also compared the difference between python2.3 and python2.4's
__import__ builtin function and I can't see any difference.

On that note, I started my zope286 with python2.4 but refreshing was
still possible so zope2.9 requiring python2.4 does not seem to be the
reason.

I'm quite stuck right now. I haven't yet really dug into how
sys.modules work. The Zope code doesn't seem to have changed inside
the function import_product() of OFS.Application.

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
this:


from DateTime import DateTime
    def index_html(self, REQUEST, RESPONSE):
         """ doc str """
         return str(DateTime())

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?



-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com


More information about the Zope mailing list