Re: [Zope] Uploading files

2005-06-08 Thread David Pratt
Hi Tino.  I was reading this and I was looking at incorporating some 
kind of response to users while processing a time consuming script.  I 
was thinking about just putting up an animated gif that says 
'Processing' (or something similar or to send some text advising where 
they are in the processing).  I am trying to understand what you are 
saying about the return. If at the end of the process you did something 
like a return or redirect will this not work properly? Is there a 
script example that you can point me to that demonstrates a 
context.REQUEST.RESPONSE.write() admidst processing somewhere to 
provide feedback while processing. Many thanks.


Regards,
David

On Friday, June 3, 2005, at 03:24 PM, Tino Wildenhain wrote:


Timeout can be an issue with large files and when the remote
server is slow. In this case, you can send some data to the
clients browser while you work, via context.REQUEST.RESPONSE.write()



Note: once you start using response.write() you cannot use return()
in your script - at least the user wont see any output from it.
You also should catch exeptions and provide meaningfull output
when they happen since the usual exeption handling will work but
the user wont see its output.

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Uploading files

2005-06-04 Thread Jens Vagelpohl


On 3 Jun 2005, at 18:09, Nikko Wolf wrote:

In my python script I use:
   filedata = container.REQUEST.file.read()
then merge this data into a MIME submission for the external web  
site, and on success, save it locally as a file.


My question is -- aside from memory usage, what problems might  
there be with this approach?


It is *highly dangerous* to start requests to external resources from  
a running Zope request, unless you make sure the external request has  
a timeout that kicks in if it hangs for any reason. Just four hanging  
external resource requests and your Zope site is dead because all  
available threads are in use...


jens

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Uploading files

2005-06-03 Thread Varun Parange
hi,

how do i uploada filein Zope using a python script??

regards,
varun__Do You Yahoo!?Tired of spam?  Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Uploading files

2005-06-03 Thread Brian Sullivan
  
 how do i upload a file in Zope using a python script??
  
 

http://www.zopelabs.com/cookbook/1006887320

is probably a place to start.
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Uploading files

2005-06-03 Thread Tino Wildenhain
Am Freitag, den 03.06.2005, 11:09 -0600 schrieb Nikko Wolf:
 Brian Sullivan wrote:
  
 how do i upload a file in Zope using a python script??
  
  
  http://www.zopelabs.com/cookbook/1006887320
  
  is probably a place to start.
 
 On that topic: I've got my file upload working properly (it forwards the 
 file data to an external site, then saves only if validation works).
 
 But I just started to wonder about something; all my tests have been 
 with relatively small files (~40KB) but my end users may be uploading 
 some very large files (possibly as large as 500KB, although not for months).
 
 In my python script I use:
 filedata = container.REQUEST.file.read()
 then merge this data into a MIME submission for the external web site, 
 and on success, save it locally as a file.
 
 My question is -- aside from memory usage, what problems might there be 
 with this approach?
 
 Will the read() return all the content, or is there a possibility that 
 it will return less than the full file contents?  Any timeout issues 
 that I should consider?

Of course does read() return all the data in one string - the python
documentation leaves no doubt here.
You might consider reading in chunks, encoding them while you send
and if validation is successfull, rewind by file.seek(0)
and then manage_addFile() directly with the file object.

Timeout can be an issue with large files and when the remote
server is slow. In this case, you can send some data to the 
clients browser while you work, via context.REQUEST.RESPONSE.write()
Note: once you start using response.write() you cannot use return()
in your script - at least the user wont see any output from it.
You also should catch exeptions and provide meaningfull output
when they happen since the usual exeption handling will work but
the user wont see its output.



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] uploading Files when using GUF

2000-12-07 Thread urs.beyeler

i try to allow users uploading files through a web-interface on 
zope2.2.1. this works fine unless i try this in a 
GenericUserFolder-controlled folder ...

i always get

Error Type: AttributeError
Error Value: getUserById

any ideas?

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] uploading Files when using GUF

2000-12-07 Thread Dieter Maurer

urs.beyeler writes:
  i try to allow users uploading files through a web-interface on 
  zope2.2.1. this works fine unless i try this in a 
  GenericUserFolder-controlled folder ...
  
  i always get
  
  Error Type: AttributeError
  Error Value: getUserById
I do not have the GenericUserFolder sources around, therefore I cannot
look:

  Apparently, your upload code uses "getUserById"
  and "GenericUserFolder" does not define it
  (while the normal UserFolder does).

  Look at the upload code and check whether you need
  the "getUserById".



Dieter

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




[Zope] Uploading files

2000-11-15 Thread Nolan Darilek

I'm trying to write a replacement form which allows users to upload
images into a folder. I'm almost there, but not quite.

I'm having difficulties getting the file contents into the database. I
have an input type="file" field, and I'm fairly sure that the data
is being sent. When I create the Image however, I use
file=REQUEST['file'], and the resulting image stores the path to the
file, instead of the file contents. So, given that I've uploaded a
file, and that its name is in REQUEST['file'], how do I get at its
contents when creating the Image?

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] Uploading files

2000-11-15 Thread Randall Kern

make sure you set the enctype correctly in your form tag:

form action="foo" method="post" enctype="multipart/form-data"

-Randy
- Original Message - 
From: "Nolan Darilek" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, November 15, 2000 5:07 PM
Subject: [Zope] Uploading files


 I'm trying to write a replacement form which allows users to upload
 images into a folder. I'm almost there, but not quite.
 
 I'm having difficulties getting the file contents into the database. I
 have an input type="file" field, and I'm fairly sure that the data
 is being sent. When I create the Image however, I use
 file=REQUEST['file'], and the resulting image stores the path to the
 file, instead of the file contents. So, given that I've uploaded a
 file, and that its name is in REQUEST['file'], how do I get at its
 contents when creating the Image?
 
 ___
 Zope maillist  -  [EMAIL PROTECTED]
 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 )
 


___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] Uploading files

2000-11-15 Thread matt

use :

file=REQUEST['file'].data

On Thu, 16 Nov 2000, Nolan Darilek wrote:
 I'm trying to write a replacement form which allows users to upload
 images into a folder. I'm almost there, but not quite.
 
 I'm having difficulties getting the file contents into the database. I
 have an input type="file" field, and I'm fairly sure that the data
 is being sent. When I create the Image however, I use
 file=REQUEST['file'], and the resulting image stores the path to the
 file, instead of the file contents. So, given that I've uploaded a
 file, and that its name is in REQUEST['file'], how do I get at its
 contents when creating the Image?
 
 ___
 Zope maillist  -  [EMAIL PROTECTED]
 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 )
-- 
Matt Halstead (PhD)
Research and development
VirtualSpectator
http://www.virtualspectator.com
ph 64-9-9136896

___
Zope maillist  -  [EMAIL PROTECTED]
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 )