Hi All,
 
I have a python script which I need to execute from a web page and I am 
using below code for it.
 
import web
class Echo:
    def GET(self):
        return """<html><form name="script-input-form" action="/" 
method="post">
<p><label for="Import"><font color=green><b>Press the button to import 
CSV</b></font)</label>
<input type="submit" value="ImportCSV"></p>
</form><html>"""
 
    def POST(self):
        data = web.input()
        return data
        obj = compile('execfile("import.py")', '', '')
        result = eval(obj, globals(), locals())
        web.seeother('/')
 
urls = (
  '/.*', Echo,
)
if __name__ == "__main__":
    app = web.application(urls, globals())
    app.run()
else:
    app = web.application(urls, globals()).wsgifunc()
 
Now I have a requirement to add one more operation and added one more 
button for that.
 
 return """<html><form name="script-input-form" action="/" method="post">
<p><label for="Import"><font color=green><b>Press the button to import 
CSV</b></font)</label>
<input type="submit" value="ImportCSV"></p>
<p><label for="Import"><font color=green><b>Press the button to ClearData 
old from Database</b></font)</label>
<input type="submit" value="Clear"></p>
</form><html>"""
 
Requirement is 
 
When ImportCSV button is pressed, it should run script import.py
When Clear button is pressed, it should run script cleardata.py
 
How can I modify the code to know which button is pressed and to execute 
the scripts based on that? 
 
Thanks and Regards,
Rijil Hari

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to