[mod_python] How declared correctly the way in the pg.html to the apache server can resolv the script python correctly

Graham Dumpleton graham.dumpleton at gmail.com
Tue Nov 20 21:51:31 EST 2007

>  def show(req):
>          soma1=req.form.getfirst('soma1','')
>          soma2=req.form.getfirst('soma2','')
>          c=soma1+soma2
>          c=cgi.escape(c)
>          r="""\
>          <html>a soma eh:%s</html>
>          """
>          return r % c

Ignoring proper error checking, you can just do:

  def show(soma1, soma2):
      return "<html>a soma eh:%d</html>" % int(soma1) + int(soma2)

All field values are strings, so you just need to convert them to correct type.


More information about the Mod_python mailing list