Re: [Zope] problem saving file twice with ange-ftp
John Hunter <jdhunter@ace.bsd.uchicago.edu> wrote: <snip>
There is one other feature of using ange-ftp that I have found dissatisfying. If I access a WikiName for the first time that has no content from ange-ftp (one of the links identified with a '?'), after I edit it, commit the changes and then view it in the browser, the page is displayed as plain text. I.e, *John* is displayed with the asterisks, not as emphasized text. So I usually have to go to my browser, access the empty wiki link, accept the default text and commit it. Then I can go in and edit it with emacs over ange-ftp. Not a big hassle but I'd rather avoid it.
If I then go into the Zope GUI manager interface and look at the type of document that was created, it is a DTML Document rather than a ZWiki Page. Any suggestions here?
You need to leverage the "PUT hook", described in the fishbowl at: http://dev.zope.org/Wikis/DevSite/Proposals/HookablePUTCreation Basically, the hook allows you to write a PythonScript (or ExternalMethod) 'PUT_factory', to override the default machinery which tries to figure out the kind of object to make when an FTP/HTTP PUT is done to a non-existent object. Sample External Method:: #Implement the "hookable PUT" hook. import re, OFS.DTMLMethod TEXT_PATTERN = re.compile( '^text/.*$' ) def PUT_factory( self, name, typ, body ): """ """ if TEXT_PATTERN.match( typ ): return OFS.DTMLMethod.DTMLMethod( '', __name__=name ) return None Tres. -- =============================================================== Tres Seaver tseaver@digicool.com Digital Creations "Zope Dealers" http://www.zope.org
participants (1)
-
Tres Seaver