Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import web
- from web import form
- render = web.template.render('templates/address/')
- urls = (
- "/add", "add_address",
- "/edit/([a-zA-Z0-9_]+)", "edit_address",
- "/show/([a-zA-Z0-9_]+)", "show_address"
- )
- vphone = form.regexp(r".[0-9\-]", "must be numbers and dashes (-)")
- add_form = form.Form(
- form.Textbox("address_id", description="Addres ID"),
- form.Textbox("phone", vphone, description="Phone"),
- form.Textbox("location", "Address"),
- form.Button("submit", type="submit", description="Add")
- )
- class add_address:
- def GET(self):
- f = add_form()
- return render.add_address(f)
- def POST(self):
- f = add_form()
- ## if not f.validates():
- return render.add_address(f)
- else:
- return render.add_address(f, True)
- #print "ALL OK!\n"
- app_address = web.application(urls, globals())
- if __name__ == "__main__": app_address.run()
Add Comment
Please, Sign In to add comment