|
Revision 102
(checked in by dpotter, 4 years ago)
|
add descriptive names to the tutorials
|
| Line | |
|---|
| 1 |
""" |
|---|
| 2 |
Tutorial 02 - Multiple methods |
|---|
| 3 |
|
|---|
| 4 |
This tutorial shows you how to link to other methods of your request |
|---|
| 5 |
handler. |
|---|
| 6 |
""" |
|---|
| 7 |
|
|---|
| 8 |
from cherrypy import cpg |
|---|
| 9 |
|
|---|
| 10 |
class HelloWorld: |
|---|
| 11 |
|
|---|
| 12 |
def index(self): |
|---|
| 13 |
|
|---|
| 14 |
return 'We have an <a href="showMessage">important message</a> for you!' |
|---|
| 15 |
|
|---|
| 16 |
index.exposed = True |
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
def showMessage(self): |
|---|
| 20 |
|
|---|
| 21 |
return "Hello world!" |
|---|
| 22 |
|
|---|
| 23 |
showMessage.exposed = True |
|---|
| 24 |
|
|---|
| 25 |
cpg.root = HelloWorld() |
|---|
| 26 |
cpg.server.start(configFile = 'tutorial.conf') |
|---|