You are not logged in Log in Join
You are here: Home » Members » Chui Tey » How to test your products without (re)starting Zope

Log in
Name

Password

 

How to test your products without (re)starting Zope

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.

  1. CD "\Program files\website\lib\python"
  2. "\Program files\website\bin\python.exe"
  3. >>> import Zope, ZPublisher
  4. >>> from Products import ZGDChart
  5. >>> 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

  6. >>> c = shortcut(id=newid)
  7. Test a method on the new instance:

    >>> c.version()

  8. do some changes in ZGDChart.py
  9. >>> reload (ZGDChart.ZGDChart)
  10. repeat steps 5 - 6 until product works.

Links

You should read the article by M.Pelletier - the debugger is your friend.