summaryrefslogtreecommitdiff
path: root/examples/complex_view.py
blob: f2106cb80b7a017527aca02449d61d45a7a45bc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import pystache

class ComplexView(pystache.View):
    template_path = 'examples'

    def header(self):
        return "Colors"

    def item(self):
        items = []
        items.append({ 'name': 'red', 'current': True, 'url': '#Red' })
        items.append({ 'name': 'green', 'link': True, 'url': '#Green' })
        items.append({ 'name': 'blue', 'link': True, 'url': '#Blue' })
        return items

    def list(self):
        return not self.empty()

    def empty(self):
        return len(self.item()) == 0