[Zope] Upload file to server for encoding...

Jonathan dev101 at magma.ca
Mon Sep 11 10:59:05 EDT 2006


----- Original Message ----- 
From: "Nick Gr" <skoupi at gmail.com>
To: "Jonathan" <dev101 at magma.ca>
Cc: <zope at zope.org>
Sent: Monday, September 11, 2006 10:46 AM
Subject: Re: [Zope] Upload file to server for encoding...


>>>>> . Any ideas how the user will download back the file? should the 
>>>>> download begin automatically after the encoding ?
>>>> If your external method commits the transaction, a new zope object will 
>>>> be created.  You could then do a response.redirect that causes the 
>>>> user's browser to access the new object.
>>>>
>>> My python program change the original file, it doesn't create another 
>>> one after the encoding. Can I use the same Zope object or it doesn't 
>>> work that way ?
>>
>> If the changes have been committed to the zope object, then when the user 
>> accesses that object the user will see the changes (just make sure the 
>> cache control headers are set so that the original object does not get 
>> cached in the user's browser)
>>
> Can't follow you on this one clearly... I think if I can accomplish the 
> previous tasks I should be able to do something with that.

If your process is as follows:

1) User specifies a file to be uploaded (via an HTML form)
2) Your form handler (an external method) receives the File Upload Object 
and immediately processes the data (your encoding process)

Then, after step 2, your external method can create a new zope object (which 
can be stored in the ZODB or on your server's file system - your choice) - 
your external method commits the transaction (which causes the new object to 
be 'persisted') - you then do a response.redirect which causes the user's 
browser to initiate a new http request to the url you specified in the 
response.redirect statement (this url will point to your new zope object).


Jonathan




More information about the Zope mailing list