Last change
on this file since 7480 was
7478,
checked in by uli, 13 years ago
|
Sample usage of multi-mechanize (not finished).
|
File size:
2.5 KB
|
Rev | Line | |
---|
[7478] | 1 | #!/usr/bin/env python
|
---|
| 2 | #
|
---|
| 3 | # Copyright (c) 2010 Corey Goldberg (corey@goldb.org)
|
---|
| 4 | # License: GNU LGPLv3
|
---|
| 5 | #
|
---|
| 6 | # This file is part of Multi-Mechanize
|
---|
| 7 | #
|
---|
| 8 |
|
---|
| 9 |
|
---|
| 10 | class Report(object):
|
---|
| 11 | def __init__(self, results_dir):
|
---|
| 12 | self.results_dir = results_dir
|
---|
| 13 | self.fn = results_dir + 'results.html'
|
---|
| 14 | self.write_head_html()
|
---|
| 15 |
|
---|
| 16 |
|
---|
| 17 | def write_line(self, line):
|
---|
| 18 | with open(self.fn, 'a') as f:
|
---|
| 19 | f.write('%s\n' % line)
|
---|
| 20 |
|
---|
| 21 |
|
---|
| 22 | def write_head_html(self):
|
---|
| 23 | with open(self.fn, 'w') as f:
|
---|
| 24 | f.write("""\
|
---|
| 25 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
---|
| 26 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
---|
| 27 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
---|
| 28 | <head>
|
---|
| 29 | <title>Multi-Mechanize - Results</title>
|
---|
| 30 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
---|
| 31 | <meta http-equiv="Content-Language" content="en" />
|
---|
| 32 | <style type="text/css">
|
---|
| 33 | body {
|
---|
| 34 | background-color: #FFFFFF;
|
---|
| 35 | color: #000000;
|
---|
| 36 | font-family: Verdana, sans-serif;
|
---|
| 37 | font-size: 11px;
|
---|
| 38 | padding: 5px;
|
---|
| 39 | }
|
---|
| 40 | h1 {
|
---|
| 41 | font-size: 16px;
|
---|
| 42 | background: #FF9933;
|
---|
| 43 | margin-bottom: 0;
|
---|
| 44 | padding-left: 5px;
|
---|
| 45 | padding-top: 2px;
|
---|
| 46 | }
|
---|
| 47 | h2 {
|
---|
| 48 | font-size: 13px;
|
---|
| 49 | background: #C0C0C0;
|
---|
| 50 | padding-left: 5px;
|
---|
| 51 | margin-top: 2em;
|
---|
| 52 | margin-bottom: .75em;
|
---|
| 53 | }
|
---|
| 54 | h3 {
|
---|
| 55 | font-size: 12px;
|
---|
| 56 | background: #EEEEEE;
|
---|
| 57 | padding-left: 5px;
|
---|
| 58 | margin-bottom: 0.5em;
|
---|
| 59 | }
|
---|
| 60 | h4 {
|
---|
| 61 | font-size: 11px;
|
---|
| 62 | padding-left: 20px;
|
---|
| 63 | margin-bottom: 0;
|
---|
| 64 | }
|
---|
| 65 | p {
|
---|
| 66 | margin: 0;
|
---|
| 67 | padding: 0;
|
---|
| 68 | }
|
---|
| 69 | table {
|
---|
| 70 | margin-left: 10px;
|
---|
| 71 | }
|
---|
| 72 | td {
|
---|
| 73 | text-align: right;
|
---|
| 74 | color: #000000;
|
---|
| 75 | background: #FFFFFF;
|
---|
| 76 | padding-left: 10px;
|
---|
| 77 | padding-right: 10px;
|
---|
| 78 | padding-bottom: 0;
|
---|
| 79 | }
|
---|
| 80 | th {
|
---|
| 81 | text-align: center;
|
---|
| 82 | padding-right: 10px;
|
---|
| 83 | padding-left: 10px;
|
---|
| 84 | color: #000000;
|
---|
| 85 | background: #FFFFFF;
|
---|
| 86 | }
|
---|
| 87 | div.summary {
|
---|
| 88 | padding-left: 20px;
|
---|
| 89 | }
|
---|
| 90 | </style>
|
---|
| 91 | </head>
|
---|
| 92 | <body>
|
---|
| 93 | """)
|
---|
| 94 |
|
---|
| 95 |
|
---|
| 96 | def write_closing_html(self):
|
---|
| 97 | with open(self.fn, 'a') as f:
|
---|
| 98 | f.write("""\
|
---|
| 99 | </body>
|
---|
| 100 | </html>
|
---|
| 101 | """)
|
---|
| 102 |
|
---|
| 103 |
|
---|
| 104 |
|
---|
| 105 |
|
---|
| 106 |
|
---|
Note: See
TracBrowser for help on using the repository browser.