|
Revision 1837
(checked in by fumanchu, 8 months ago)
|
Fix for #756 (Deprecate server.quickstart):
- server.quickstart now does nothing but raise a warning.
- Made 'root' argument to cherrypy.quickstart optional (to make tutorials easier, but it applies broadly).
- Removed all calls to server.quickstart.
|
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
""" |
|---|
| 2 |
Tutorial - Multiple methods |
|---|
| 3 |
|
|---|
| 4 |
This tutorial shows you how to link to other methods of your request |
|---|
| 5 |
handler. |
|---|
| 6 |
""" |
|---|
| 7 |
|
|---|
| 8 |
import cherrypy |
|---|
| 9 |
|
|---|
| 10 |
class HelloWorld: |
|---|
| 11 |
|
|---|
| 12 |
def index(self): |
|---|
| 13 |
|
|---|
| 14 |
return 'We have an <a href="showMessage">important message</a> for you!' |
|---|
| 15 |
index.exposed = True |
|---|
| 16 |
|
|---|
| 17 |
def showMessage(self): |
|---|
| 18 |
|
|---|
| 19 |
return "Hello world!" |
|---|
| 20 |
showMessage.exposed = True |
|---|
| 21 |
|
|---|
| 22 |
cherrypy.tree.mount(HelloWorld()) |
|---|
| 23 |
|
|---|
| 24 |
if __name__ == '__main__': |
|---|
| 25 |
import os.path |
|---|
| 26 |
thisdir = os.path.dirname(__file__) |
|---|
| 27 |
cherrypy.quickstart(config=os.path.join(thisdir, 'tutorial.conf')) |
|---|
| 28 |
|
|---|