Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- import cherrypy
- class Contact:
- username = str
- def __init__(self, username=None):
- self.username = username
- @cherrypy.expose
- def index(self):
- return str(self.username)
- @cherrypy.expose
- def edit(self, newUsername):
- if(newUsername):
- return 'change ' + self.username + ' to ' + newUsername
- return 'please supply a newUsername for ' + username
- @cherrypy.expose
- def delete(self):
- return 'delete ' + self.username
- class Root:
- @cherrypy.expose
- def default(self):
- return 'index'
- def _cp_dispatch(self, vpath):
- return Contact(username=vpath[0])
- cherrypy.quickstart(Root())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement