Problems posting with urlencode

Joseph Chase chase at youknowwho.com
Sun Oct 2 05:24:17 EDT 2005


I have the following form :


<form action="/auction/create/" method="post"><p><label 
for="auction_created">Created</label><br /></p>
<p><label for="auction_user">User</label><br /><input id="auction_user" 
name="auction[user]" size="30" type="text" value="" /></p>
<p><label for="auction_auction_title">Auction title</label><br /><input 
id="auction_auction_title" name="auction[auction_title]" size="30" 
type="text" value="" /></p>
<p><label for="auction_auction_url">Auction url</label><br /><input 
id="auction_auction_url" name="auction[auction_url]" size="30" type="text" 
value="" /></p>
<p><label for="auction_modification_rec">Modification rec</label><br 
/><input id="auction_modification_rec" name="auction[modification_rec]" 
size="30" type="text" value="" /></p>
<p><label for="auction_state">State</label><br /><input id="auction_state" 
name="auction[state]" size="30" type="text" value="" /></p><input 
name="commit" type="submit" value="Create" /></form>


I post the form data with the following calls:

        params = urllib.urlencode({"auction[user]" :user, 
"auction[auction_title]": auction_title,"auction[auction_url]": auction_url, 
"auction[modification_rec]" :recommendation, "auction[state]=": 
state,"commit":"Create"})

        print "Storing...."
        data = urllib.urlopen(self.baseUrl,params)


When I go and view the inserted record, the record exists, but the field 
values are null.  It is my thinking that the backend needs the "id" value 
for each input value; how do I add that data to the urlencode() call?

When I utilize the above form, all is inserted and all of the field values 
appear.  What data am I not accounting for with my program; for its obvious 
that the browser is sending something to the server that my application is 
not.

Thanks. 





More information about the Python-list mailing list