[Zope] Re: ref another file while adding file in ZMI

Tim Hicks tim@sitefusion.co.uk
Tue, 20 Aug 2002 00:27:12 +0100


Patrick,

if I understand you correctly, you are trying to use the add File screen of
the ZMI.  In the 'File' (file upload) box, you are trying to reference a
file in the ZODB.  If that's right, it'll never work coz the browser simply
reads the path in the box, finds that file on your local system, then
uploads it.  It is entirely separate from the ZODB at that stage.

Or have I misunderstood you?

tim

----- Original Message -----
From: "Patrick Price" <jprice22@wvu.edu>
To: "Tim Hicks" <tim@sitefusion.co.uk>
Cc: <zope@zope.org>
Sent: Tuesday, August 20, 2002 12:12 AM
Subject: [Zope] Re: ref another file while adding file in ZMI


>
>
> Tim Hicks wrote:
> >>Rather than have to upload a file while adding a file object using ZMI,
> >>how can I refer to another existing file in the object tree?
> >>
> >>I tried putting "/root/refs/quotes/file1" in the File box but the file
> >>that was added had a mime type of application/octet-stream so I had
> >>to set the mime type to text/html which is what the original object was.
>  >> Why didn't it pick up on the fact that file1 is text/html itself?
> >>
> >>I could copy the file but am trying to learn...
> >
> > > You're trying to get a new object into the ZODB that is a copy of one
that
> > is already stored?  Why don't you want to use the copy/paste procedure,
> > that's what it's there for?
> >
> > tim
> >
>
> I guess that what I observed was that even though the add file method
> uses the file extension (?) to determine the file type, if this same
> method is used to refer to an already existing file object within Zope,
> it won't do this.  I am guessing that the file extension attribute (if
> that's what the file add method is using to determine file type and not
> scanning for magic numbers in the file) is lost once the file is inside
> the ZODB, and the method for adding file objects external to Zope wasn't
> written with internal objects in mind.
>
> It would make sense from an OO viewpoint (and from my limited Python/OO
> knowledge) if a method dealing with objects could handle both internal
> and external file objects in a consistent manner, but it's probably not
> necessary in this case as there are other facilities for copying files.
>
> I was just curious.  Thanks for the reply regardless.
>
> -Patrick
> PS: My quoted text herein slightly edited to make more sense
>
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )