[ create a new paste ] login | about

Link: http://codepad.org/nE4PnQIx    [ raw code | fork ]

Python, pasted on Mar 17:
#!/usr/bin/env python

from circuits.web import Server, Controller


class Root(Controller):

    def index(self):
        """Index Request Handler

        Controller(s) expose implicitly methods as request handlers.
        Request Handlers can still be customized by using the ``@expose``
        decorator. For example exposing as a different path.
        """

        return "Hello World!"


class Foo(Controller):

    channel = "/foo"

    def index(self):
        return "FooBar!"


class Bar(Controller):

    channel = "/bar"

    def index(self):
        return "Bar!"


app = Server(("0.0.0.0", 9000))
(Root() + (Foo() + Bar())).register(app)
app.run()


Create a new paste based on this one


Comments: