[Zope] ExtFile on Zope 2.4.0
Dirk Nehring
dirk.nehring@qubiz.com
Thu, 6 Sep 2001 22:37:23 +0200
On Thu, Sep 06, 2001 at 03:55:54PM -0400, Ron Bickers wrote:
> > -----Original Message-----
> > From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Frank
> > Stephan
>
> > is there any info on 'ExtFile with Zope 2.4.0'
> >
> > On the product page it says:
> >
> > Note: ExtFile currently does not support Zope 2.4.x because of a bug /
> > change-of-behaviour in this Zope version. See collector item
> > #2442 for more
> > info. I'm currently working on a fix for ExtFile, so stay tuned...
>
> As far as I can tell, the only thing that doesn't work about it is copying
> and pasting ExtFile objects.
>
> By design, when you copy and paste an ExtFile, a copy of the file is made
> with a new name in the ExtFile repository. A change in Zope 2.4 breaks
> that, so you end up with a copy of the object in the ZODB, but they both
> reference the same file in the repository...obviously a very bad thing.
>
> Adding and deleting ExtFile objects, however, appears to function as
> designed.
Here's a patch:
def manage_afterClone(self, item):
""" When a copy of the object is created (zope
copy-paste-operation),
this function is called by CopySupport.py. A copy of the
external
file is created and self.filename is changed.
"""
old_fn = self._get_filename(self.filename)
new_fn = self._get_filename(self._get_new_ufn())
if isfile(old_fn):
self._copy(old_fn, new_fn)
self.filename = new_fn
self.index_object()
return ExtFile.inheritedAttribute ("manage_afterClone") (self,
item)
And delete in manage_afterAdd() everything under _v_has_been_cloned,
since it is not needed any more.
The author is informed.
Dirk
--
Dirk Nehring | Phone: +49 5241 80-1560
QuBiz GmbH | Fax: +49 5241 80-9518
An der Autobahn 18 | PGP: 69AA BD83 8065 A1DE BBA4
33311 Gütersloh | DE54 1F14 C2AE 739A 32D9