Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/plugins/slow.py
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2005-07-09 15:54:31 +0200
committerArthur de Jong <arthur@arthurdejong.org>2005-07-09 15:54:31 +0200
commit14b0704d4aa5c534d42c1dbc61a849a08a39c593 (patch)
tree07b4aae356825f4f52955e8c53f8288fdc07276b /plugins/slow.py
parenta9a9f80aaa1c7c46bf1b4289a9e3524b264bbae4 (diff)
clean up HTML output generating XHTML 1.1 without frames and using CSS for styling also getting rid of the images
git-svn-id: http://arthurdejong.org/svn/webcheck/webcheck@57 86f53f14-5ff3-0310-afe5-9b438ce3f40c
Diffstat (limited to 'plugins/slow.py')
-rw-r--r--plugins/slow.py39
1 files changed, 16 insertions, 23 deletions
diff --git a/plugins/slow.py b/plugins/slow.py
index 9157f7b..14f635f 100644
--- a/plugins/slow.py
+++ b/plugins/slow.py
@@ -19,41 +19,34 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-"""Present a list of pages that are slow to download."""
+"""Present a list of pages that are large and probably slow to download."""
__title__ = "what's slow"
__author__ = 'Arthur de Jong'
__version__ = '1.1'
+__description__ = 'These pages are probably too big which will be slow to download.'
import rptlib
import config
def generate(fp,site):
- """Output the list of slow pages to the given file descriptor."""
- import time
- fp.write('<div class="table">\n')
- fp.write('<table border="0" cellpadding="2" cellspacing="2" width="75%">\n')
- fp.write(' <tr><th rowspan="2">Link</th>\n')
- fp.write(' <th rowspan="2">Size <br>(Kb)</th>\n')
- fp.write(' <th colspan="3">Time (HH:MM:SS)</th></tr>\n')
- fp.write(' <tr><th>28.8</th><th>ISDN</th><th>T1</th></tr>\n')
- links = site.linkMap.values()
+ """Output the list of large pages to the given file descriptor."""
+ fp.write(' <ul>\n')
+ links=site.linkMap.values()
links.sort(lambda a, b: cmp(a.totalSize, b.totalSize))
for link in links:
if not link.html:
continue
+ # TODO: print size nicely
sizeK = link.totalSize / 1024
- sizek = link.totalSize * 8 / 1000
if sizeK < config.REPORT_SLOW_URL_SIZE:
- break
- fp.write(' <tr><td>%s</td>' % make_link(link.URL)+'\n')
- fp.write(' <td>%s</td>\n' % sizeK)
- fp.write(' <td class="time">%s</td>\n' \
- % time.strftime('%H:%M:%S',time.gmtime(int(sizek/28.8))))
- fp.write(' <td class="time">%s</td>\n' \
- % time.strftime('%H:%M:%S',time.gmtime(int(sizek/56))))
- fp.write(' <td class="time">%s</td></tr>\n' \
- % time.strftime('%H:%M:%S',time.gmtime(int(sizek/1500))))
- rptlib.add_problem('Slow Link: %sK' % sizeK, link)
- fp.write('</table>\n')
- fp.write('</div>\n')
+ continue
+ fp.write(
+ ' <li>\n' \
+ ' %(link)s\n' \
+ ' <div class="status">size: %(size)sK</div>\n' \
+ ' </li>\n' \
+ % { 'link': rptlib.make_link(link.URL),
+ 'size': sizeK })
+ rptlib.add_problem('slow Link: %sK' % str(sizeK), link)
+ fp.write(' </ul>\n')