[Zope-CMF] Interesting outside link
seb bacon
seb@jamkit.com
Mon, 11 Jun 2001 13:20:55 +0100
* Tres Seaver <tseaver@palladion.com> [010611 12:09]:
> What does the filename or content-type look like for one of those? I
> have a mapping there now for it for "url, link" (tests....oops, Link
> objects don't know from PUT). We'll need to fix this too, then. Please
> do let us know what the PUT will look like for Win32 shortcuts (filename
> pattern, content type, and file layout).
Well, it's a bit of a tricky one. I couldn't find a spec for it
anywhere on the internet. There's no content-type that I could find
either, so I invented 'text/url'. Gnome uses the 'text/plain'
mimetype and doesn't use an extension, so I'm not sure how we could
hook it. Win shortcuts always have the .url extension, and always
have a 'BASEURL' line in them, so the following seems to work fine,
but I can't be certain :)
def PUT(self, REQUEST, RESPONSE):
"""Handle HTTP (and presumably FTP?) PUT requests"""
self.dav__init(REQUEST, RESPONSE)
body = REQUEST.get('BODY', '')
url=""
# could test here for different link types
# the following works for Win Shortcuts
match = re.search(r'BASEURL=(.*)\s',body)
if match: url=match.group(1)
self.edit(url)
RESPONSE.setStatus(204)
return RESPONSE
seb