summaryrefslogtreecommitdiff
path: root/tasks.py
blob: 737f54012d9de3d409ec345d8b53059c3410f9ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from twisted.protocols import amp
from ampoule import child


def fib(n):
    if n <= 2:
        return 1
    else:
        return fib(n-1) + fib(n-2)


class Fib(amp.Command):
    response = [("fib", amp.Integer())]


class FibCalculator(child.AMPChild):
    @Fib.responder
    def fib(self):
        print 'called responder, fib...'
        return {"fib": fib(30)}