[ create a new paste ] login | about

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

Python, pasted on Jul 16:
from circuits import Debugger, Component, Event
from circuits.web import Controller, Server

class Bar(Event): pass

class Foo(Component):
	
	def event(self):
		return "Hello World!"
		
	def bar(self):
		x = yield self.call(Event())
		print x.value
		
class Index(Controller):

	def _wrapcall(self):
		x = yield self.call(Event())
		yield x.value

	def index(self):
		x = yield self.call(Event())
		yield x.value
		
	def wrap(self):
		x = self._wrapcall()
		return x.next()

def test_nocontroller():
	global f
	f = Foo()
	(Debugger() + f).start()
	
def test_controller():
	global s
	s = Server(8080)
	i = Index()
	f = Foo()
	(Debugger() + s + i + f).start()


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


Create a new paste based on this one


Comments: