[z3-five] Re: Fw: Re: Refresh and Five
Philipp von Weitershausen
philipp at weitershausen.de
Wed Nov 3 19:05:57 MET 2004
Andy Adiwidjaja wrote:
> LR> I have some problems with Five, namely, refresh doesn't seem to work. Is
> LR> this normal? If I refresh just the product, all pages seems to
> LR> disappear. I also get an error if I refresh Five...
>
> LR> Any ideas?
>
> This is the normal behaviour. Problem is that the global services
> survive the refresh but Five tries to import the configuration. As the
> configuration is already loaded, the configuration conflicts.
>
> For development, I use a workaround with a second product. In the
> initialize of this product __init__, I clear the services, allowing
> to reload the config.
>
> Some code::
>
> from zope.app.zapi import getGlobalServices
> from Products.Five import zcml
>
> def resetConfiguration():
> serviceManager = getGlobalServices()
> serviceManager._clear()
>
> def initialize( context ):
> resetConfiguration()
> print "Reloading Config"
> zcml.load_site()
>
> Note that _clear does only delete the references to the services. If
> the services are singletons and do have state, you have to clear them
> explicitly. I had this problems with the menu service.
Very nice solution. Do you think you can add this to the Five core?
Provided, of course, that you document and test it properly. I think
this should definitely go into the FAQ at least.
Note that Zope 3 does not provide refresh functionality itself and it
might never do that since it depends on the bootstrap configuration to
be intact much more.
Philipp
More information about the z3-five
mailing list