[Zope] PUT_factory to create ZWikiPage by default - help

John Hunter jdhunter@ace.bsd.uchicago.edu
18 Apr 2001 14:42:29 -0500


>>>>> "John" == John Hunter <jdhunter@ace.bsd.uchicago.edu> writes:

    John> I'll run though what I did step-by-step for the benefits of
    John> other newbies such as myself who want implement this:

I have since learned that the pages described in the method above have
the default 'page_type' as structuredtext.  If you want manager users
operating via ange-ftp to be able to create dtml enabled ZWikiPages,
you need to change the default page type in the PUT_factory.  I now
have created two PUT_factory 'External Methods', one dtml enabled, one
not.

#/usr/local/Zope/Extensions/PUT_ZWikiPage.py
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':
              ob = ZWikiPage( '', __name__=name )
              return ob
       return None

#/usr/local/Zope/Extensions/PUT_ZWikiPageDTML.py
def PUT_factory( self, name, typ, body ):
       """
          Override the default PUT method to make a DTML enabled ZWikiPage the
          default type for ftp uploads
       """
       from Products.ZWiki.ZWikiPage import ZWikiPage
       if typ == 'text/plain':
              ob = ZWikiPage( '', __name__=name )
              ob.page_type = 'structuredtextdtml'
              return ob
       return None

I've updated the HOWTO at
http://zwiki.org/HowToCreateZWikiPagesWithPut with this info.


BTW this was the cause of my strange dtml-var syntax behavior reported
in the thread 'calling dtml-var from ZwikiPage; strange syntax': the
page was created via ange-ftp and was not dtml enabled.

Cheers,
John Hunter