How to test your products without (re)starting Zope
Created by .
Last modified on 2003/08/05.
How to debug product development
Abstract
Simple Python classes do amazing things once
they inherit Zope machinery classes such as
Acquisition, Persistent, Access control.
Testing your products without restarting
the server is possible if you knew how.
Steps
These worked for me in Windows, ymmv.
- CD "\Program files\website\lib\python"
- "\Program files\website\bin\python.exe"
- >>> import Zope, ZPublisher
- >>> from Products import ZGDChart
- >>> shortcut= ZGDChart.ZGDChart.ZGDChart
Just a comment about the long incantation.
ZGDChart is Products/__init__.py
ZGDChart.ZGDChart is Products/ZGDChart.py
ZGDChart.ZGDChart.ZGDChart is Products/ZGDChart.py/ZGDChart class
- >>> c = shortcut(id=
newid)
- Test a method on the new instance:
>>> c.version()
- do some changes in ZGDChart.py
- >>> reload (ZGDChart.ZGDChart)
- repeat steps 5 - 6 until product works.
Links
You should read the article by M.Pelletier - the debugger is your friend.
|