[mod_python] Newbie Question

mail-lists mail-lists at peachnet.com
Thu Apr 10 15:51:17 EDT 2008


Colin Bean wrote:
> Are you looking for sessions (
> http://modpython.org/live/current/doc-html/pyapi-sess.html )?  That's
> really the only way to persist your object across redirects...

No, I don't think that's what I want to do.

I just really want to do the same thing as a form does except on the 
server side ie. I want to set attributes in the FieldStorage class.

I'm going to hazard a guess here and say that my concept of this is 
wrong and I cannot modify the request object the way I think I can.
Maybe I can write out what I'm doing:

##############################

def addcustomer(req):

	html = """A bunch of html that displays among other things the
                   following form:
                     <form action=savecustomer method="get">
                       <input type="text" name="customer_name">
                       <input type="submit">""""

	return html


def savecustomer(req):

	req_data=util.FieldStorage(req)

	customer_name=req_data["customer_name"].value
	valid = myvalidatefunction(customer_name)
	
	if ! valid:
	   #HOW DO I SET THE ITEM IN THE FIELDSTORAGE CLASS HERE
	   util.redirect(req, "addcustomer")


#############################

I don't know if that makes it any clearer or not.
	

Thanks for all the help on this!


More information about the Mod_python mailing list