blob: 6548699d1e4d9df3b8a3a4b2385b449dac4c8047 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#!/usr/bin/python3
'''
NetSurf test ordered list generator
The liststyle form parameter may be given to select different list style types.
'''
import os
import re
import cgi
import cgitb
cgitb.enable()
def main():
'''
The test plan generator
'''
docroot = os.environ["DOCUMENT_ROOT"]
testroot = os.path.join(docroot, "monkey-test")
params = cgi.FieldStorage()
liststyle = 'decimal'
listcount = 1000
if 'liststyle' in params and re.match('^[A-Za-z0-9-]+$', params['liststyle'].value):
liststyle = params['liststyle'].value
if 'listcount' in params and re.match('^[0-9]+$', params['listcount'].value):
listcount = int(params['listcount'].value)
if listcount > 10000:
listcount = 10000
print('Content-Type: text/html')
print('')
print('<!DOCTYPE html>')
print('<html>')
print('<head>')
print('<style>')
print('ol.a {list-style-type:',liststyle,';}')
print('</style>')
print('</head>')
print('<body>')
print('<h1>ordered list marker test with',liststyle,'style</h1>')
print('<ol class="a">')
for num in range(1, listcount):
print('<li>',num,'</li>', sep="")
print('</ol>')
print('</body>')
print('</html>')
if __name__ == "__main__":
main()
|