- Plone 3 Products Development Cookbook
- Juan Pablo Gimenez Marcos F.Romero
- 374字
- 2021-08-06 17:05:59
Applying code changes on-the-fly using plone.reload
When a Zope instance is running in debug mode, most of the changes made in the underlying code (except for templates, Python scripts, and some other resources like CSS) won't be refreshed in the server until it is restarted. This means that if we want to test a new method or if we had detected a problem and solved it, we must restart our Zope server to see the results. At first glance, it doesn't seem to be a big deal. However, in the rush of development or when making lots of little changes in the code, this could really be a pain in the neck. This is especially true if we are working with a production database because they normally take a long time during server launch.
Fortunately , plone.reload
can come to our rescue. In a fraction of a second it detects and refreshes all the changes made to the code. Moreover, if we had modified configuration options (not .py
files but .zcml
, as we'll see in future chapters), we can apply them on-the-fly also.
How to do it…
- Add a
plone.reload
line in theeggs
parameter of the[buildout]
part.[buildout] ... # Add additional eggs here eggs = plone.reload
How it works…
You just need to point your browser URL to http://localhost:8080/@@reload
(notice that @@reload
is called on Zope instance root and not on Plone site) and click on the corresponding button to:
- Reload code (
.py
files). - Reload code and configuration options (
.py
and.zcml
).
After doing this, you'll get a short log about the files that were detected during reload.
Unfortunately, plone.reload
does not always work. If you find unexpected error messages (typically ComponentLookupError
or could not adapt
) in your console, it is most likely that plone.reload
couldn't do the whole job properly. In these situations, just restart your instance to continue working.
There's more…
You may want to remember (or save a bookmark in your browser) the URL of the resulting action to speed up your code changes:
http://localhost:8080/@@reload?action=code
, for code changeshttp://localhost:8080/@@reload?action=zcml
, for code and configuration changes
Note
More information about plone.reload
is available at: http://pypi.python.org/pypi/plone.reload.
- EJB 3.0 Database Persistence with Oracle Fusion Middleware 11g: LITE
- Sencha Touch Cookbook, Second Edition
- Learning VirtualDub: The complete guide to capturing, processing and encoding digital video
- CakePHP 1.3 Application Development Cookbook
- Word 2010實戰技巧精粹
- Drupal 6 Panels Cookbook
- BIRT 2.6 Data Analysis and Reporting
- Google App Engine Java and GWT Application Development
- 綁定的藝術:Maya高級角色骨骼綁定技法(第2版)
- 中文版After Effects 2022基礎教程
- UG NX 9中文版從入門到精通
- Visio圖形設計從新手到高手(兼容版)
- 平面設計制作標準教程(微課版 第2版)
- 構筑敏捷的開發團隊:微軟Visual Studio 2010實戰兵法
- Joomla! E/Commerce with VirtueMart