[Zope] Extending Zope system code without editing

Dylan Reinhardt zope@dylanreinhardt.com
Tue, 04 Mar 2003 10:12:41 -0800


At 08:50 AM 3/4/2003, Dennis Allison wrote:
>Not quite...  How do I modify a class defined in lib/python/StructuredText
>or lib/python/ZPublisher or the like with the minimum of fuss and without
>patching the actual distributed Zope system code...

If you're looking for a way to change the behavior of an object without 
making *any* changes to the source code, I'm pretty sure that subclassing 
is all that's available.  It is possible to define objects such that they 
allow certain methods to be overridden by ZMI objects, but that is special 
behavior that must be explicitly provided in the product.

For my money, inheritance is about as low-impact a mechanism as one can 
hope to find.  Unless I'm not understanding what you're trying to do or 
what issues this approach raises... in which case, let me know.

If the major stopping point here is concern about hosing Zope, there are 
several things you can do to mitigate the potential harm:

1. Work on a test installation
2. Use comments liberally
3. Use a tool like rcs or cvs to provide version control
4. Refine your technique on a trivial product like Boring

There's no better way to learn how Zope really works than to rip into the 
source.  My advice would be to go for it.

HTH,

Dylan