[Zope] How to add mutiple files
Vibhu Srinivasan
vibhu@spiderlogic.com
Thu, 16 May 2002 10:15:25 -0500
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C1FCEC.81265920
Content-Type: text/plain;
charset="iso-8859-1"
Thanks all I got my answer
-----Original Message-----
From: John Hunter [mailto:jdhunter@ace.bsd.uchicago.edu]
Sent: Thursday, May 16, 2002 10:05 AM
To: Vibhu Srinivasan
Cc: 'zope@zope.org'
Subject: Re: [Zope] How to add mutiple files
>>>>> "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
------_=_NextPart_001_01C1FCEC.81265920
Content-Type: text/html;
charset="iso-8859-1"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>RE: [Zope] How to add mutiple files</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>Thanks all I got my answer</FONT>
</P>
<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: John Hunter [<A HREF="mailto:jdhunter@ace.bsd.uchicago.edu">mailto:jdhunter@ace.bsd.uchicago.edu</A>]</FONT>
<BR><FONT SIZE=2>Sent: Thursday, May 16, 2002 10:05 AM</FONT>
<BR><FONT SIZE=2>To: Vibhu Srinivasan</FONT>
<BR><FONT SIZE=2>Cc: 'zope@zope.org'</FONT>
<BR><FONT SIZE=2>Subject: Re: [Zope] How to add mutiple files</FONT>
</P>
<BR>
<P><FONT SIZE=2>>>>>> "Vibhu" == Vibhu Srinivasan <vibhu@spiderlogic.com> writes:</FONT>
</P>
<P><FONT SIZE=2> Vibhu> I want to copy a number of documents to be linked from</FONT>
<BR><FONT SIZE=2> Vibhu> ZWiki in Zope. Is there a way i can directly copy the files</FONT>
<BR><FONT SIZE=2> Vibhu> to the Zope directory without actually having to got</FONT>
<BR><FONT SIZE=2> Vibhu> through adding each one through the management interface.</FONT>
<BR><FONT SIZE=2> Vibhu> Thanks Vibhu S</FONT>
</P>
<P><FONT SIZE=2>ftp your zope server on port 21 and 'put' them. If these are plain</FONT>
<BR><FONT SIZE=2>old files (*.doc, *.pdf, *.jpg, etc...) the default put method will</FONT>
<BR><FONT SIZE=2>work fine for you. If you want these files to be a special type, like</FONT>
<BR><FONT SIZE=2>ZWiki pages, you'll need to write your own PUT_factory and make it an</FONT>
<BR><FONT SIZE=2>External Method. Here is an example:</FONT>
</P>
<P><FONT SIZE=2>def PUT_factory( self, name, typ, body ):</FONT>
<BR><FONT SIZE=2> """</FONT>
<BR><FONT SIZE=2> Override the default PUT method to make ZWikiPage the</FONT>
<BR><FONT SIZE=2> default type for ftp uploads</FONT>
<BR><FONT SIZE=2> """</FONT>
<BR><FONT SIZE=2> from Products.ZWiki.ZWikiPage import ZWikiPage</FONT>
<BR><FONT SIZE=2> if typ == 'text/plain':</FONT>
<BR><FONT SIZE=2> ob = ZWikiPage( '', __name__=name )</FONT>
<BR><FONT SIZE=2> ob.page_type = 'structuredtextdtml'</FONT>
<BR><FONT SIZE=2> return ob</FONT>
<BR><FONT SIZE=2> elif ... other types...</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> else:</FONT>
<BR><FONT SIZE=2> return None</FONT>
</P>
<P><FONT SIZE=2>John Hunter</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C1FCEC.81265920--