Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

root/branches/cherrypy-2.x/cherrypy/tutorial/tut02_expose_methods.py

Revision 762 (checked in by fumanchu, 3 years ago)

Set svn:eol-style to "native" for all .py files. This should fix any line-ending problems for existing files: Windows users will receive CRLF endings when they check out files, and *nix users will receive LF endings. Whenever you "svn add" a new file, make sure its svn:eol-style property is "native"!

  • 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         # Let's link to another method here.
14         return 'We have an <a href="showMessage">important message</a> for you!'
15     index.exposed = True
16    
17     def showMessage(self):
18         # Here's the important message!
19         return "Hello world!"
20     showMessage.exposed = True
21
22 cherrypy.root = HelloWorld()
23
24 if __name__ == '__main__':
25     cherrypy.config.update(file = 'tutorial.conf')
26     cherrypy.server.start()
27
Note: See TracBrowser for help on using the browser.

Hosted by WebFaction

Log in as guest/cpguest to create tickets