[mod_python] Python started with -U option as an Apache handler

Diener, Edward Edward.Diener at loyaltyworks.com
Wed May 19 14:24:00 EDT 2004


Problem has been solved by having my first bang line in the .py file end
in python -u

	-----Original Message-----
	From: Michael C. Neel [mailto:neel at mediapulse.com] 
	Sent: Wednesday, May 19, 2004 1:00 PM
	To: Diener, Edward
	Cc: mod_python at modpython.org
	Subject: RE: [mod_python] Python started with -U option as an
Apache handler
	
	
	I take it your using FieldStorage class of mod_python correct?
Take a look at the docs should help:
	
	http://modpython.org/live/current/doc-html/pyapi-util-fstor.html
	
http://modpython.org/live/current/doc-html/pyapi-util-fstor-fld.html
	
	And since you mention you've used cgi in the past, take note of
the folling in the docs:
	
	"Note: Unlike the standard library cgi module FieldStorage
class, a Field object is returned only when it is a file upload. In all
other cases the return is an instance of StringField. This means that
you do not need to use the .value attribute to access values of fields
in most cases."
	
	I don't use the FieldStorage class, but it looks like you want
form["AFormField"].file
	
	Mike
	
	On Wed, 2004-05-19 at 12:33, Diener, Edward wrote: 

		The form has 
		
		enctype="multipart/form-data"
		
		In the HTML page.
		
		I don't see why the form's enctype should affect how CGI
creates a
		string from a file when one specifies
form["AFormField"].value for a
		form field of <input type="file" name="AFormField"> but
I will take any
		help I can get on this. Evidently when CGI creates a
string from the
		file name when this access is done, it is opening the
file as a text
		file rather than a binary file, which is not good.
		
		-----Original Message-----
		From: Michael C. Neel [mailto:neel at mediapulse.com] 
		Sent: Wednesday, May 19, 2004 11:52 AM
		To: Diener, Edward
		Cc: mod_python at modpython.org
		Subject: Re: [mod_python] Python started with -U option
as an Apache
		handler
		
		
		I've handled serveral file types in mod_python from
uploaded forms, and
		didn't need anything special set.  If your not getting
the files, check
		that the form has the correct enctype set.  If you are
getting data
		that's incorrect, post some details on how you are
accessing the files
		to the list.
		
		Mike
		
		On Wed, 2004-05-19 at 11:22, Diener, Edward wrote: 
		How do I get Apache to start python with the -U option
when it is used
		in an AddHandler statement ? When using straight CGI,
and the file
		upload functionality in it, python must be started with
the -U option in
		order for it to upload binary files, as opposed to text
files,
		correctly.
		
		
		
		_______________________________________________
		Mod_python mailing list
		Mod_python at modpython.org
		http://mailman.modpython.org/mailman/listinfo/mod_python
<http://mailman.modpython.org/mailman/listinfo/mod_python> 
		__________________________________
michael.neel at mediapulse.comvice
		president of information systems865.675.4455
		x30800.380.4514www.mediapulse.com
<http://www.mediapulse.com> __________________________________ 

	
__________________________________ 

michael.neel <mailto:michael.neel at mediapulse.com> @mediapulse.com
<mailto:michael.neel at mediapulse.com> 
vice president of information systems
865.675.4455 x30
800.380.4514

www.mediapulse.com <http://www.mediapulse.com/> 
__________________________________ 	


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://modpython.org/pipermail/mod_python/attachments/20040519/d97a4e76/attachment.html


More information about the Mod_python mailing list