Nagare: python continuation-based (stackless)web framework: (pypi.python.org) 8 points by gtani 17y ago ↗ HN
[–] emmett 17y ago ↗ Framework announcements should always come with sample code. Always. Talking about how great it is doesn't help me understand how it works. [–] apoirier 17y ago ↗ The complete canonical example of the counter. Of course with the back button and browser fork working.Launched with : nagare-admin serve-module counter.py:Counter counter =============================================== from nagare import presentation # A pure python Counter class class Counter: def __init__(self, v=0): self.v = v def increase(self): self.v += 1 def decrease(self): self.v -= 1 # Default HTML view on the Counter class @presentation.render_for(Counter) def render(self, h, *args): return h.div( h.p('Value: ', self.v), h.a('++').action(self.increase), ' | ', h.a('--').action(self.decrease) )
[–] apoirier 17y ago ↗ The complete canonical example of the counter. Of course with the back button and browser fork working.Launched with : nagare-admin serve-module counter.py:Counter counter =============================================== from nagare import presentation # A pure python Counter class class Counter: def __init__(self, v=0): self.v = v def increase(self): self.v += 1 def decrease(self): self.v -= 1 # Default HTML view on the Counter class @presentation.render_for(Counter) def render(self, h, *args): return h.div( h.p('Value: ', self.v), h.a('++').action(self.increase), ' | ', h.a('--').action(self.decrease) )
3 comments
[ 3.2 ms ] story [ 20.3 ms ] threadLaunched with : nagare-admin serve-module counter.py:Counter counter ===============================================