summaryrefslogtreecommitdiff
path: root/examples/console/web/index.py
blob: aec3498f6f48e006052fc633bc62ed86658c5511 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from console.sitepage import SitePage
from console.JSONComponent import JSONComponent
from console.evalcontext import EvalContext

context = EvalContext()

class index(SitePage):

    components = SitePage.components + [
        JSONComponent(baseConfig='console')]

    def setup(self):
        self.options.title = 'Console'
        
    def jsonMethods(self):
        return ['run']
    
    def run(self, expr):
        if not expr.endswith('\n'):
            expr += '\n'
        return context.exec_expr(expr)