"John" == John Hunter <jdhunter@ace.bsd.uchicago.edu> writes:
John> Following the advice of Dieter Maurer and Tres Seaver I am John> trying to use PUT_factory to override the default object John> type and create a ZWikiPage when I create a page by John> ange-ftp. Because I am a zope and python newbie, I am John> having some trouble. OK, I have finally got this thing working. Part of the problem was that I was trying to do this as a PythonScript instead of as an ExternalMethod. But from http://www.zope.org/Members/michel/Projects/Interfaces/NewObjectPutHandler regarding PUT_factory methods: MJ> PythonScripts cannot be used for this; you cannot give Python MJ> Scripts access to classes that have been protected by MJ> permissions. This includes any class that inherits from MJ> PropertyManager, for example. I'll run though what I did step-by-step for the benefits of other newbies such as myself who want implement this: 1) Create a file in /the/path/to/zope/Extensions called PUT_ZwikiPage.py (or name it whatever you like) with the content: def PUT_factory( self, name, typ, body ): """ Override the default PUT method to make ZWikiPage the default type for ftp uploads """ from Products.ZWiki.ZWikiPage import ZWikiPage if typ == 'text/plain': return ZWikiPage( '', __name__=name ) return None # I think that returning None will invoke the default PUT handler from # NullResources.py 2) From the ZWiki folder you are working in, add an External Method with 'Select type to add'->'External Method' 3) enter the following info in the fields in the dialog box Id PUT_factory Title (optional) Module Name PUT_ZwikiPage Function Name PUT_factory 4) You're done. You should be able to create new links via ange-ftp. Thanks to Dieter Maurer, Tres Seaver, Tim Hicks, and Brian Lloyd for useful info in previous responses and posts. John Hunter