Configuration and code reload without server restarts.
Configuration and code reload for Zope 2 and Plone without server restarts.
While being logged into the ZMI as an user with the Manager role visit /@@reload on your Zope application root via a browser. If your Zope is configured to listen on port 8080 on localhost this is:
If you get a Resource not found error, make sure you have loaded the configure.zcml file from this library and you really use the ZODB application root and not a Plone site as the base url.
When you press the Reload Code button, all modules that have been changed since the last time they were loaded are reloaded. You’ll get a status message telling you which modules have been reloaded.
To reload all ZCML without a restart, press the ‘Reload Code and ZCML’ button.
The action to perform is determined via a simple query string, so once you did a ‘Reload Code’ once, you can simply reload the browser page to execute the action once again.
Caveats: There’s some code structures which cannot be reloaded via the approach underlying this library. Plone portlets and content types are two examples of this. In general decorators will currently not always work.
The code and issue tracker can be found on GitHub at: https://github.com/plone/plone.reload
This code is heavily based on the Products.RefreshNG product found at http://launchpad.net/refreshng.
The original xreload.py written by Guido van Rossum can be found at http://svn.python.org/projects/sandbox/trunk/xreload/xreload.py
It has some enhancements, but those seem to break more code than do any good in a Zope environment with patched in meta classes and monkey patches all over the place.
- Hanno Schlichting (primary author)
- Martin Aspeli (test contribution)
- Use zope.interface decorator. [gforcada]
- Minor packaging fixes. [gforcada, maurits]
- Update test assertions to avoid deprecation warnings under Python 2.7. [hannosch]
- Relicensed to BSD. [hannosch]
- Minor PEP8 cleanup. [hannosch]
- Exclude tests from the shipped source distribution. [hannosch, iElectric]
- Require at least Zope 2.12 / Python 2.6 and add preliminary support for Zope 2.13 with Python 2.6 and 2.7. [hannosch]
- Update license to GPL version 2 only. [hannosch]
- Fixed some tests that relied on a specific directory layout. [hannosch]
- Fixed a bug in dealing with class descriptors, like Five’s BoundTemplateFile. We replaced the descriptor with the descriptor result, leading to strange problems. We check for those by looking directly into the __dict__ and comparing it to the result of a normal getattr call. [hannosch, optilude]
- Use a different hook for providing the initial setup of tracked code files. In Zope 2.12+ there’s a proper event published right before the process has started. If this is available we use it, instead of our no longer working approach to hook setupFinalLogging. [hannosch]
- Moved the template reloading support into an extra. [hannosch]
- Added test_suite functions to the test modules. [hannosch]
- Added CMF specific functionality: We support explicitly reloading all file system based objects from skins folders while running in production mode. [hannosch]
- Avoid the ENABLED config flag and check against Globals.DevelopmentMode in the browser view. [hannosch]
- Make sure the import of the Globals module happens after the variable has been set. This should make it compatible with Zope 2.10.9+. [hannosch]
- Got the test coverage for the code reloading part up to 100%. [hannosch]
- Fixed reloading of the module scope. The func_globals of functions is now updated with new names introduced into the module scope, so adding new import statements will work. [hannosch]
- Specified package dependencies, added development buildout and added extensive test coverage. [hannosch]
- Figured out a way to support reloading code that uses decorators. [hannosch]
- Added the z3c.autoinclude entry point so that plone.reload is automatically loaded on Plone 3.3 and above. [optilude]
- Do not remove attributes from classes when reloading. ZCML directives and other wiring is liable to add attributes to class that will then disappear on reload. This means that if you have removed a class attribute, it will not disappear on reload. In this case: restart. :) [optilude]
- Removed the manual cleanup approach for extra registries populated by ZCML parsing. Instead we use the registry of cleanup functions inside zope.testing.cleanup to automatically pick up all cleaning functions. [hannosch]
- Wrap the setupFinalLogging method of the Zope2 starter objects to initialize our internal modified times registry once after Zope is finished loading. This is the closest I could find that resembles a Zope is finished loading event and should help to remove the double-reload behavior. [hannosch]
- Only expose the reload view in Zope 2 development mode. [hannosch]
- In case of errors during ZCML reload, restore the original global site manager state, instead of leaving it in a broken state. This allows you to fix and retry the ZCML reload as many times as you need. [hannosch]
- Merged the two distinct views into one called @@reload. Added a somewhat nicer UI to it and explain some of the current limitations on that page. [hannosch]
- Refactored ZCML loading code a bit. Always do an automatic code reload before reloading ZCML. [hannosch]
- Removed all blacklisting code. [hannosch]
- Disabled blacklist until it can be made configurable. The speedup is hardly noticeable anyway, and it can block too much (especially if plone.reload is being used in a lib/python style deployment rather than as an egg). [optilude]
- Merged r20 from http://bazaar.launchpad.net/~refreshng-dev/refreshng/dev. This fixes https://bugs.launchpad.net/refreshng/+bug/175898. [hannosch]
- Removed various levels of caching which turned out to be premature and caused lots of modules not to be found. [hannosch]
- Made the code reload available as its own @@code_reload view. [hannosch]
- Integrated xreload.py from RefreshNG and added a first working version of a general manual code reload feature. [hannosch]
- Fixed caching issues by invalidating all ZODB caches. If you have local site managers spread across multiple FileStorages this might still not work as expected. [hannosch]
- Added cleanup for CMFCore and PAS. [hannosch]
- Added compatibility with Zope 2.10 / Plone 3.0. [hannosch]
- Initial implementation based heavily on Products.RefreshNG. [hannosch]
- Initial package structure. [zopeskel]