[Zope] How to add mutiple files

John Hunter jdhunter@ace.bsd.uchicago.edu
Thu, 16 May 2002 10:04:34 -0500


>>>>> "Vibhu" == Vibhu Srinivasan <vibhu@spiderlogic.com> writes:

    Vibhu> I want to copy a number of documents to be linked from
    Vibhu> ZWiki in Zope. Is there a way i can directly copy the files
    Vibhu> to the Zope directory without actually having to got
    Vibhu> through adding each one through the management interface.
    Vibhu> Thanks Vibhu S

ftp your zope server on port 21 and 'put' them.  If these are plain
old files (*.doc, *.pdf, *.jpg, etc...) the default put method will
work fine for you.  If you want these files to be a special type, like
ZWiki pages, you'll need to write your own PUT_factory and make it an
External Method.  Here is an example:

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 )
              ob.page_type = 'structuredtextdtml'
              return ob
        elif ... other types...
              
        else:
               return None

John Hunter