[ create a new paste ] login | about

Project: circuits
Link: http://circuits.codepad.org/VW5zm1Dm    [ raw code | output | fork ]

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

from circuits import handler, Component
from circuits.web import Server


class Filter1(Component):

    @handler("request", priority=1.0)
    def _on_request(self, request, response):
        response.body = "Hello World"
        return response


class Filter2(Component):

    @handler("request", filter=True, priority=2.0)
    def _on_request(self, request, response):
        yield None

from circuits import Debugger
(Server(("0.0.0.0", 8080)) + Filter1() + Filter2() + Debugger()).run()


Output:
1
2
3
4
Traceback (most recent call last):
  Line 3, in <module>
    from circuits import handler, Component
ImportError: No module named circuits


Create a new paste based on this one


Comments: