It is recommended you not use low level WSGI interface and instead used higher level framework. A good micro framework is Flask.
http://flask.pocoo.org/ It will do all this sort of forms handling for you. If you really must use low level WSGI there is a tutorial at: http://webpython.codepoint.net/wsgi_tutorial Try first the examples in there about forms handling with cgi module. When you understand those, adapt your example to suit. Graham On 3 June 2011 04:10, nitin chandra <[email protected]> wrote: > Hello Everyone, > > i managed to get this working with my apache+mod_wsgi > > but some how I am not able to wrap my head around to > use lxml.html in "response.py" instead of 'cgi'. > > Please guide me how to use lxml > > I am currently testing the various settings before seriously coding ... > once lxml issue is resolved. > > Thanks > > Nitin > ============================= > index.py > ------------- > > #!/usr/bin/env python > > import os, re, sys > > class Handler: > def do(self, environ, start_response): > #uri = environ['REQUEST_URI'] > html = "<html><head><title>C Informatics</title></head><body>" > html += "<h1><center>Hospital Management & Information > System</h1><br>" > html += '<p><br>' > html += '<p><br>' > html += '<p><br>' > html += '<center>' > html += '<form method="post" action="response.py">' > html += 'User Name :<input type="text" name="name"><br>' > html += 'Password   :<input type="password" > name="paswd1"><br>' > html += '<table>' > html += '<TR/><TD NOWRAP/>Highest Qualifications:' > html += '<TD/><SELECT name="hiqual"/>' > html += '<OPTION/>Ph.D / Doctorate' > html += '<OPTION/>Post Graduation' > html += '<OPTION/>Post Graduation Diploma' > html += '<OPTION SELECTED/>Graduation' > html += '<OPTION/>Diploma' > html += '<OPTION/>Undergraduate' > html += '</SELECT/><br>' > html += '<input type="submit" Value="Log In">' > html += '</form>' > html += '</center>' > html += "</body></html>" > output = html > mimeType = "text/html" > > status = "200 OK" > response_headers = [("Content-type", mimeType), > ("Content-length", str(len(output)))] > > start_response(status, response_headers) > return [output] > > # wsgi entry point > def application(environ, start_response): > handler = Handler() > return handler.do(environ, start_response) > > ============================================= > > response.py > ----------------- > > #!/usr/bin/env python > > import os, re, sys > import cgi > > class Handler: > def do(self, environ, start_response): > form = cgi.FieldStorage(fp=environ['wsgi.input'], > environ=environ) > name = form.getvalue('name') > paswd1 = form.getvalue('paswd1') > hiqual = form.getvalue('hiqual') > html = 'name is ' > html += name > html += ' and password is ' > html += paswd1 > html += '<br> Highest Qualification is : '+ hiqual > output = html > mimeType = "text/html" > > status = "200 OK" > response_headers = [("Content-type", mimeType), > ("Content-length", str(len(output)))] > > start_response(status, response_headers) > return [output] > > # wsgi entry point > def application(environ, start_response): > handler = Handler() > return handler.do(environ, start_response) > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/modwsgi?hl=en. > > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
