FTP automangling file extension: semi-working proof-of-concept
Yesterday, I suggested that it might be helpful for FTP & WebDAV to return a pseudo-extension for the type of file being read so that non-Zope-saavy programs could more effectively work with Zope files. (Some programs, notably Dreamweaver and GoLive, refuse to work w/files w/o extensions.) When the file is later uploaded via FTP/WebDAV, the extension would be removed. I've tinkered ~30min with the source code and made two very trivial changes to produce a proof-of-concept. This does the following: 1) in FTP, all files are shown with ".foo" extension 2) when a file is rec'd, the ".foo" is stripped back off It's __far__ from a real implementation: the extensions would be sensitive to the type of file being edited; the ".foo" stripping code should check to see if this is a WebDAV/FTP transfer (right now it *always* strips the .foo off!), etc. However, even with this trivial patch, it works well enough to: 1) teach Dreamweaver that .foo files should be edited w/dreamweaver 2) through Zope, create a "test" DTML Document 3) in Dreamweaver+FTP, this test doc shows up as test.foo 4) this can be edited in Dreamweaver and saved 5) the changes appear as "test" in Zope. What I'd Like: Is this a fair idea? I doubt the fine folks at ZopeCorp will rush my three-line patch into the core ;-), but I'd would like to get the sense if I'm heading in a sane direction. Obviously, you should apply this patch to a production server: (patched to the Zope 2.4 source) [joel@eos joel]$ diff -Naur old new diff -Naur old/lib/python/OFS/ObjectManager.py new/lib/python/OFS/ObjectManager.py --- old/lib/python/OFS/ObjectManager.py Thu Jul 5 15:09:08 2001 +++ new/lib/python/OFS/ObjectManager.py Sat Jul 28 02:38:43 2001 @@ -660,7 +660,7 @@ try: stat=marshal.loads(v.manage_FTPstat(REQUEST)) except: stat=None if stat is not None: - out=out+((k,stat),) + out=out+((k+'.foo',stat),) # WJB return marshal.dumps(out) def manage_FTPstat(self,REQUEST): @@ -689,6 +689,10 @@ def __getitem__(self, key): + + if key[-4:]=='.foo': # WJB + key=key[:-4] + v=self._getOb(key, None) if v is not None: return v if hasattr(self, 'REQUEST'): -- Joel Burton <jburton@scw.org> Director of Information Systems, Support Center of Washington
participants (1)
-
Joel Burton