[Zope-dev] direction

Shane Hathaway shane at hathawaymix.org
Thu Jul 7 03:24:44 EDT 2011


On 07/06/2011 10:59 AM, Hanno Schlichting wrote:
> The ZMI is a highly insecure, completely outdated and user-unfriendly interface.

As I read this, I got an idea for a possible way forward.  I haven't 
been reading zope-dev much lately, so forgive me if something like this 
has been mentioned already.

What if we had decorators that let us disable old code by default, yet 
allowed users to enable the old code with configuration?  Something like 
this:


import zope.oldcode

class SomeClass(SimpleObject):

     @zope.oldcode.zmi
     def manage_edit(self, REQUEST):
         # ...


The idea here is we'll create a zope.oldcode egg and fill it with 
decorators for pervasive features of Zope that need to be removed over 
time, such as the current ZMI.  We'll also create a configuration switch 
for each of those old features so that people can keep using them for a 
reasonable period of time.  When the "zmi" feature is disabled, the code 
above will replace the manage_edit method with a "zope.oldcode.Disabled" 
object that raises a helpful exception if anyone tries to call it.

It would also be good to make these decorators implement __nonzero__ to 
allow conditional attribute definition:

     if zope.oldcode.zmi:
         manage_properties = (...)

I would want to make sure conditional tests are possible as well:

     @zope.oldcode.zmi
     def test_manage_edit(self):
         # ...

(The zope.oldcode package probably ought to enable all old features by 
default when running tests.)

What do you think?

Shane



More information about the Zope-Dev mailing list