ExtFile Extention Mappings
In our quest to replace the not-quite-working External File product, we're looking at ExtFile. However, when I upload files into an ExtFile, file extensions on the file system are being changed. test1.txt becomes test1.ksh, test2.doc becomes test2.dot. They have the correct ID's in the ZMI, but on the file system they now have something quite new. Our solution relies on accessing via the ZMI and the file system at the same time, so the name being changed is somewhat inconvenient in its unpredictability (and I think Apaches mime types will get nicely screwed if we start bypassing Zope to get at them). I've done some poking at the source code but don't see why ExtFile is doing this or what logic it uses. I bet someone out there knows. --- Edward J. Pollard, B.Sc Webmaster, University of Lethbridge Ext. 1828
Hi, Have you had a look at the Config.py file? I believe you can change the settings there so that the Zope filenames are preserved including the extensions. More specifically, I am referring to the following section in Config.py: <section> # repository file extension handling ZOPEID = 0 # use ZOPEID (even if it doesn't include an extension) MIMETYPE_APPEND = 1 # append extension to ZOPEID according to mimetype MIMETYPE_REPLACE = 2 # remove extension from ZOPEID, then append mime extension REPOSITORY_EXTENSIONS = MIMETYPE_REPLACE </section> Thanks. Satchit Edward Pollard wrote:
In our quest to replace the not-quite-working External File product, we're looking at ExtFile. However, when I upload files into an ExtFile, file extensions on the file system are being changed. test1.txt becomes test1.ksh, test2.doc becomes test2.dot. They have the correct ID's in the ZMI, but on the file system they now have something quite new.
Our solution relies on accessing via the ZMI and the file system at the same time, so the name being changed is somewhat inconvenient in its unpredictability (and I think Apaches mime types will get nicely screwed if we start bypassing Zope to get at them). I've done some poking at the source code but don't see why ExtFile is doing this or what logic it uses.
I bet someone out there knows.
--- Edward J. Pollard, B.Sc Webmaster, University of Lethbridge Ext. 1828
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Why? Because one of the main tricks of ExtFile is the ability to have files and images served statically by Apache, right out of the repository. Apache determines the mime type to serve from the file extension, ergo ExtFile has to make sure there is one. How? from mimetypes import guess_extension ext = guess_extension(self.content_type) If this yields the wrong result perhaps your system's mimetypes table is messed up? I must admit my use case is images for the most part, and they work just fine. If this does not do what you want poke around a bit in Config.py. You can change almost every aspect of ExtFile's repository handling. hth, Stefan On 8. Apr 2005, at 19:17, Edward Pollard wrote:
I've done some poking at the source code but don't see why ExtFile is doing this or what logic it uses.
-- Software Engineering is Programming when you can't. --E. W. Dykstra
participants (3)
-
Edward Pollard -
Satchidanand Haridas -
Stefan H. Holek