[wwwsearch-commits] r17648 - wwwsearch/ClientForm/trunk/examples
jjlee at codespeak.net
jjlee at codespeak.net
Sun Sep 18 20:33:15 CEST 2005
Author: jjlee
Date: Sun Sep 18 20:33:13 2005
New Revision: 17648
Modified:
wwwsearch/ClientForm/trunk/examples/example.html
wwwsearch/ClientForm/trunk/examples/example.py
Log:
Fixes to example
Modified: wwwsearch/ClientForm/trunk/examples/example.html
==============================================================================
--- wwwsearch/ClientForm/trunk/examples/example.html (original)
+++ wwwsearch/ClientForm/trunk/examples/example.html Sun Sep 18 20:33:13 2005
@@ -4,7 +4,9 @@
</head>
<body>
-<form action="http://wwwsearch.sf.net/cgi-bin/echo.cgi">
+<!--Note that echo.cgi doesn't show file upload data-->
+<form action="http://wwwsearch.sourceforge.net/cgi-bin/echo.cgi"
+ method="POST" enctype="multipart/form-data">
<input type="textarea" name="blah"></input>
<input type="text" name="comments"></input>
Modified: wwwsearch/ClientForm/trunk/examples/example.py
==============================================================================
--- wwwsearch/ClientForm/trunk/examples/example.py (original)
+++ wwwsearch/ClientForm/trunk/examples/example.py Sun Sep 18 20:33:13 2005
@@ -2,13 +2,13 @@
import ClientForm
import urllib2
-request = urllib2.Request("http://wwwsearch.sf.net/ClientForm/example.html")
-#request = urllib2.Request("http://localhost/example.html")
+request = urllib2.Request(
+ "http://wwwsearch.sourceforge.net/ClientForm/example.html")
response = urllib2.urlopen(request)
forms = ClientForm.ParseResponse(response)
response.close()
## f = open("example.html")
-## forms = ClientForm.ParseFile(f, "http://www.example.com/form.html")
+## forms = ClientForm.ParseFile(f, "http://example.com/example.html")
## f.close()
form = forms[0]
print form # very useful!
@@ -124,10 +124,10 @@
# Add files to FILE controls with .add_file(). Only call this multiple
# times if the server is expecting multiple files.
# add a file, default value for MIME type, no filename sent to server
-#form.add_file(open("data.dat"))
+form.add_file(open("data.dat"))
# add a second file, explicitly giving MIME type, and telling the server
# what the filename is
-#form.add_file(open("data.txt"), "text/plain", "data.txt")
+form.add_file(open("data.txt"), "text/plain", "data.txt")
# All Controls may be disabled (equivalent of greyed-out in browser)
control = form.find_control("comments")
More information about the wwwsearch-commits
mailing list