[Zope] create File object from Python Script?
Eric Walstad
eric@walstads.net
Tue, 21 Aug 2001 14:17:23 -0700
Hi Kyler,
Here's the DTML that creates the file object with a time based serial id:
<dtml-call "REQUEST.set('ts', ZopeTime())">
<dtml-call "REQUEST.set('id',_.str(_.int(ts)))">
<dtml-call "manage_addFile(id='pwp'+REQUEST['id']+'.fdf',
title=REQUEST['USER_NAME']+'_'+REQUEST['PROJ_NAME']+' FDF File',
file=getFDF(REQUEST.form))">
Note that "getFDF()" is an External Method in this case, but all it does is
return a string. You can replace it with a string literal or a Python
Script that returns a string, etc,
Hope that helps.
Eric.
> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Kyler
> B. Laird
> Sent: Tuesday, August 21, 2001 1:58 PM
> To: zope@zope.org
> Subject: [Zope] create File object from Python Script?
>
>
>
> O.k., I'm stumped. I've been looking over old
> messages and source code, but I haven't come
> to enlightenment on creating a File from a
> string. I can only create one from an
> uploaded file.
>
> I thought maybe I was on to something with
> using StringIO, but that's not allowed.
>
> I'd greatly appreciate a pointer to anything
> that might get me started.
>
> Thank you.
>
> --kyler
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )