Ticket #1539: lost_url.py

File lost_url.py, 810 bytes (added by ygravrand, 3 years ago)
Line 
1# -*- coding: utf-8 -*-
2from nagare import component, presentation
3
4class App(object):
5   
6    def __init__(self):
7        self.comp1 = component.Component(Comp1(), url='comp1')
8       
9       
10class Comp1(object):
11   
12    def __init__(self):
13        self.comp2 = component.Component(Comp2())
14       
15    def action(self):
16        pass
17
18
19class Comp2(object):
20   
21    def action(self):
22        pass
23
24
25@presentation.render_for(App)
26def render_app(self, h, comp, *args):
27    return self.comp1
28
29
30@presentation.render_for(Comp1)
31def render_comp1(self, h, comp, *args):
32    h << h.a('comp1').action(self.action)
33    h << self.comp2.render(h.AsyncRenderer())
34    return h.root
35
36
37@presentation.render_for(Comp2)
38def render_comp2(self, h, comp, *args):
39    h << h.a('comp2').action(self.action)
40    return h.root