CherryPy , , , , . , , ; , __init__ .
. - , ; URI URI , . , , ( ) ( ). , .
, CherryPy , ββ , . 1) , URI, URI, (. http://docs.cherrypy.org/dev/intro/concepts/config.html ) 2) , URI, URI, , . . http://docs.cherrypy.org/dev/intro/concepts/tools.html
, : cherrypy.root :
def make_app():
root = Root()
root.foo = Foo()
root.bars = BarCollection()
return root
Root, Foo Bar . , , "infer templates". :
from cherrypy import expose
class Foo(MyAppBase):
@expose()
def index(self, a, b, c):
...
root.foo = Foo(template='foo.html')
:
from cherrypy import expose, tools
class Foo(object):
@tools.render(template='foo.html')
@expose()
def index(self, a, b, c):
...
root.foo = Foo()
... "tools.render" - CherryPy, , . :
[/foo/]
tools.render.template = 'foo2.html'