Restarting zope for plone development
In ye olde barbaric days, one thing was handy: templates and python
scripts reloaded just fine in debug mode and a refresh.txt in your
product went a long way to not having to restart your zope too often.
Zcml only loads on startup, so a change there means a zope restart, probably nothing to be done about that. But I seem to be restarting zope for just about every single little python change.
So I asked around on the mailinglist last month: on the current strategies for preventing too many zope restarts during development? I was bound to miss a few tips and tricks otherwise :-) So here's a summary.
- Raphael Ritz had the shortest answer: TDD. Yes, test driven development is core to preventing restarts as you minimize the amount of in-browser testing and trying.
- I've tried RefreshNG and that seemed to work reasonably OK. Not all the time, but it helped. Andreas Jung rightfully mentioned it. I didn't install it in the last projects I worked on: time for a more focused test later this month.
- Kai points towards my restart-preventing product of
choice: pyflakes
. The best python syntax checker available! Missing imports,
=instead of==, head-slapping stuff like that. Catch it before restarting zope :-) - Kai again: PDBDebugMode can help you to find a solution exactly at the point of error. It does actually prevent try-error-retry restarts and is a joy to use.
Martin Aspeli provided the full list of rules on what requires a restart:
- If you are in non-debug-mode, a restart is required for any change at all, more or less.
- If you are in debug mode, any .pt file changed anywhere does not require a restart
- If you are in debug mode, any Zope 3 browser resource (accessed with the ++resource++ namespace) can be changed without a restart
- GenericSetup XML files and Install.py files (unless there's also an Install.pyc file, but you can delete it while Zope is running) created in Extensions for use by portal_quickinstaller can be changed without a restart. However, a custom setuphandler in a normal .py file cannot be change.d
- Anything in a skin layer will not require a restart - that includes Script (Python)'s.
- Any other kind of .py file change will require a restart
- Any ZCML change will require a restart
Those plone mailing lists sure are great :-)
Tags: plone


Thanks Reinout!
mailing lists are really helpful, and all the plone people is kicking ass, but you rule, and i propose you as one of the best plone reporter out there!
hope you'll have a great 2008 and to meet you soon!
Maurizio