File: tablehtml.py

package info (click to toggle)
nevow 0.10.0-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,280 kB
  • sloc: python: 21,511; ansic: 136; sh: 65; xml: 42; makefile: 31; sql: 5
file content (22 lines) | stat: -rw-r--r-- 663 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import random

from twisted.python import util

from nevow import loaders
from nevow import rend


class Table(rend.Page):

    # addSlash is used to automatically ad a slash at the end of each url
    # http://localhost:8080/foo -> http://localhost:8080/foo/
    addSlash = True
    docFactory = loaders.xmlfile(util.sibpath(__file__, 'tablehtml.html'))

    def data_theList(self, context, data):
        return [(x, random.randint(0, 5000)) for x in range(random.randint(0, 10))]
        
    def render_row(self, context, data):
        context.fillSlots('first_column', data[0])
        context.fillSlots('second_column', data[1])
        return context.tag