PageRenderTime 7ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/examples/web/jsontool.py

https://bitbucket.org/prologic/circuits/
Python | 22 lines | 13 code | 8 blank | 1 comment | 0 complexity | c7d60170176170543f75c31620f051f6 MD5 | raw file
 1#!/usr/bin/env python
 2
 3from json import dumps
 4
 5from circuits.web import Server, Controller
 6
 7
 8def json(f):
 9    def wrapper(self, *args, **kwargs):
10        return dumps(f(self, *args, **kwargs))
11    return wrapper
12
13
14class Root(Controller):
15
16    @json
17    def getrange(self, limit=4):
18        return list(range(int(limit)))
19
20app = Server(("0.0.0.0", 8000))
21Root().register(app)
22app.run()