[Zope-dev] Re: Broken FTP ZClass PUT 2.3.0

Sean Treadway seant@superchannel.org
Tue, 30 Jan 2001 10:40:58 +0100


Tres Seaver(tseaver@digicool.com)@Mon, Jan 29, 2001 at 04:59:05PM -0500:
> On Mon, 29 Jan 2001, Sean Treadway wrote:
> 
> > I have recently upgraded to 2.3.0 and it has broken my FTP
> > support.  When I try to do an FTP upload to an instance of my
> > ZClass, it fails because it is calling the default PUT of a
> > webdav.Collection instead of the PUT of my python base class.
> > 
> > My setup is such:
> > 
> > A Python product with a ObjectManger(ish) base class that
> > overrides PUT to do special manipulation of large files.  I
> > have a bunch of ZClasses that inherit from my base classes for
> > the management pages, meta data handling and 'live' updates.
> > 
> > Now, instead of PUT being called on my base class, it is being
> > called on webdav.Collection which throws an exception.
> > 
> > In 2.3.0 ZClass inherits Base, webdav.Collection and SimpleItem
> > where in 2.2.x ZClass only inherits from SimpleItem.
> > 
> > Is there any way to get my old functionality back (without
> > editing Zope)?
> 
> If I understand your motive correctly, you have been overriding
> PUT in order to control the type of the subobject created?  If
> so, please have a look at the "hookable PUT" proposal, which I
> implemented for Zope 2.3:
> 
>   http://dev.zope.org/Wikis/DevSite/Proposals/HookablePUTCreation

This is great, and I was just about to implement this before seeing that
it was "in the works" for 2.3.0.  A motivator to upgrade.  Though I will
be using the PUT_factory for creating new objects, my problem is
in updating existing instances.

I wish to change/update the contents of an instance of the ZClass that
inherits a python class where I have overrided PUT.  Rather than
creating objects, the object is already created.  When it receives an
upload through FTP it parses and updates the Zope attributes directly
from the file.  Incidently, my Zope object is also an ObjectManager.

You can reproduce this with the following steps:

* Create a python product with one class (PClass) that overrides PUT.
* Register that class as a base class in __init__.py
* Create a Product, add a ZClass (MyClass) that inherits from PClass.
* Create an instance of MyClass (ob).
* FTP STOR something to the new instance of MyClass.

It will fail because the in the inheritance tree, PUT is first overrided
by webdav.Collection.Collection.PUT (By ZClass) rather than PClass.PUT.

MyClass
    ZClass
        Base
        webdav.Collection.Collection
        SimpleItem
    PClass
    
I hope this is more clear,
-Sean