code cleanup

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@712 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2003-01-05 16:18:06 +00:00
parent ceea0e4bac
commit 8b8c7a5e49
8 changed files with 61 additions and 60 deletions

View file

@ -16,8 +16,8 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
import ConfigParser, sys, os, re, UserDict, string, time, Cookie
import _linkchecker_configdata, linkcheck, linkcheck.log
from os.path import expanduser,normpath,normcase,join,isfile
import _linkchecker_configdata, linkcheck
from os.path import expanduser, normpath, normcase, join, isfile
from types import StringType
from urllib import getproxies
from debuglevels import *

View file

@ -14,9 +14,10 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
import time, linkcheck, linkcheck.Config
import time
from linkcheck.log import strtime
from StandardLogger import StandardLogger
from linkcheck import Config, _
class CSVLogger (StandardLogger):
""" CSV output. CSV consists of one line per entry. Entries are
@ -30,12 +31,12 @@ class CSVLogger (StandardLogger):
if self.fd is None: return
self.starttime = time.time()
if self.logfield("intro"):
self.fd.write("# "+(linkcheck._("created by %s at %s\n") % (linkcheck.Config.AppName,
self.fd.write("# "+(_("created by %s at %s\n") % (Config.AppName,
strtime(self.starttime))))
self.fd.write("# "+(linkcheck._("Get the newest version at %s\n") % linkcheck.Config.Url))
self.fd.write("# "+(linkcheck._("Write comments and bugs to %s\n\n") % \
linkcheck.Config.Email))
self.fd.write(linkcheck._("# Format of the entries:\n")+\
self.fd.write("# "+(_("Get the newest version at %s\n") % Config.Url))
self.fd.write("# "+(_("Write comments and bugs to %s\n\n") % \
Config.Email))
self.fd.write(_("# Format of the entries:\n")+\
"# urlname;\n"
"# recursionlevel;\n"
"# parentname;\n"
@ -83,14 +84,14 @@ class CSVLogger (StandardLogger):
self.stoptime = time.time()
if self.logfield("outro"):
duration = self.stoptime - self.starttime
name = linkcheck._("seconds")
self.fd.write("# "+linkcheck._("Stopped checking at %s") % strtime(self.stoptime))
name = _("seconds")
self.fd.write("# "+_("Stopped checking at %s") % strtime(self.stoptime))
if duration > 60:
duration = duration / 60
name = linkcheck._("minutes")
name = _("minutes")
if duration > 60:
duration = duration / 60
name = linkcheck._("hours")
name = _("hours")
self.fd.write(" (%.3f %s)\n" % (duration, name))
self.fd.flush()
self.fd = None

View file

@ -14,10 +14,10 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
import sys, linkcheck
import sys
from linkcheck.log import Spaces, LogFields
from StandardLogger import StandardLogger
from linkcheck import StringUtil
from linkcheck import StringUtil, _
AnsiType = {
'bold': "1",
@ -107,11 +107,11 @@ class ColoredLogger (StandardLogger):
self.fd.write(LogFields["url"]+Spaces["url"]+self.colorurl+
urlData.urlName+self.colorreset)
if urlData.line:
self.fd.write(linkcheck._(", line %d")%urlData.line)
self.fd.write(_(", line %d")%urlData.line)
if urlData.column:
self.fd.write(linkcheck._(", col %d")%urlData.column)
self.fd.write(_(", col %d")%urlData.column)
if urlData.cached:
self.fd.write(linkcheck._(" (cached)\n"))
self.fd.write(_(" (cached)\n"))
else:
self.fd.write("\n")
@ -136,7 +136,7 @@ class ColoredLogger (StandardLogger):
self.fd.write("| ")
self.fd.write(LogFields["dltime"]+Spaces["dltime"]+
self.colordltime+
(linkcheck._("%.3f seconds") % urlData.dltime)+
(_("%.3f seconds") % urlData.dltime)+
self.colorreset+"\n")
if urlData.dlsize>=0 and self.logfield("dlsize"):
if self.prefix:
@ -149,7 +149,7 @@ class ColoredLogger (StandardLogger):
self.fd.write("| ")
self.fd.write(LogFields["checktime"]+Spaces["checktime"]+
self.colordltime+
(linkcheck._("%.3f seconds") % urlData.checktime)+self.colorreset+"\n")
(_("%.3f seconds") % urlData.checktime)+self.colorreset+"\n")
if urlData.infoString and self.logfield("info"):
if self.prefix:

View file

@ -16,8 +16,8 @@
from StandardLogger import StandardLogger
from linkcheck.log import strtime, LogFields
from linkcheck import StringUtil
import time, linkcheck, linkcheck.Config
from linkcheck import StringUtil, _, Config
import time
HTML_HEADER = """<!DOCTYPE html PUBLIC "-//W3C//DTD html 4.01//EN">
<html><head><title>%s</title>
@ -49,12 +49,12 @@ class HtmlLogger (StandardLogger):
def init (self):
if self.fd is None: return
self.starttime = time.time()
self.fd.write(HTML_HEADER%(linkcheck.Config.App, self.colorbackground,
self.fd.write(HTML_HEADER%(Config.App, self.colorbackground,
self.colorlink, self.colorlink, self.colorlink))
if self.logfield('intro'):
self.fd.write("<center><h2>"+linkcheck.Config.App+"</h2></center>"+
"<br><blockquote>"+linkcheck.Config.Freeware+"<br><br>"+
(linkcheck._("Start checking at %s\n") % strtime(self.starttime))+
self.fd.write("<center><h2>"+Config.App+"</h2></center>"+
"<br><blockquote>"+Config.Freeware+"<br><br>"+
(_("Start checking at %s\n") % strtime(self.starttime))+
"<br>")
self.fd.flush()
@ -72,7 +72,7 @@ class HtmlLogger (StandardLogger):
"<td bgcolor="+self.colorurl+">"+LogFields["url"]+"</td>\n"+
"<td bgcolor="+self.colorurl+">"+urlData.urlName)
if urlData.cached:
self.fd.write(linkcheck._(" (cached)"))
self.fd.write(_(" (cached)"))
self.fd.write("</td>\n</tr>\n")
if urlData.name and self.logfield("name"):
self.fd.write("<tr>\n<td>"+LogFields["name"]+"</td>\n<td>"+
@ -82,9 +82,9 @@ class HtmlLogger (StandardLogger):
'</td>\n<td><a target="top" href="'+urlData.parentName+'">'+
urlData.parentName+"</a>")
if urlData.line:
self.fd.write(linkcheck._(", line %d")%urlData.line)
self.fd.write(_(", line %d")%urlData.line)
if urlData.column:
self.fd.write(linkcheck._(", col %d")%urlData.column)
self.fd.write(_(", col %d")%urlData.column)
self.fd.write("</td>\n</tr>\n")
if urlData.baseRef and self.logfield("base"):
self.fd.write("<tr>\n<td>"+LogFields["base"]+"</td>\n<td>"+
@ -95,7 +95,7 @@ class HtmlLogger (StandardLogger):
'">'+urlData.url+"</a></td>\n</tr>\n")
if urlData.dltime>=0 and self.logfield("dltime"):
self.fd.write("<tr>\n<td>"+LogFields["dltime"]+"</td>\n<td>"+
(linkcheck._("%.3f seconds") % urlData.dltime)+
(_("%.3f seconds") % urlData.dltime)+
"</td>\n</tr>\n")
if urlData.dlsize>=0 and self.logfield("dlsize"):
self.fd.write("<tr>\n<td>"+LogFields["dlsize"]+"</td>\n<td>"+
@ -104,7 +104,7 @@ class HtmlLogger (StandardLogger):
if urlData.checktime and self.logfield("checktime"):
self.fd.write("<tr>\n<td>"+LogFields["checktime"]+
"</td>\n<td>"+
(linkcheck._("%.3f seconds") % urlData.checktime)+
(_("%.3f seconds") % urlData.checktime)+
"</td>\n</tr>\n")
if urlData.infoString and self.logfield("info"):
self.fd.write("<tr>\n<td>"+LogFields["info"]+"</td>\n<td>"+
@ -134,39 +134,39 @@ class HtmlLogger (StandardLogger):
def endOfOutput (self, linknumber=-1):
if self.fd is None: return
if self.logfield("outro"):
self.fd.write("\n"+linkcheck._("Thats it. "))
self.fd.write("\n"+_("Thats it. "))
#if self.warnings==1:
# self.fd.write(linkcheck._("1 warning, "))
# self.fd.write(_("1 warning, "))
#else:
# self.fd.write(str(self.warnings)+linkcheck._(" warnings, "))
# self.fd.write(str(self.warnings)+_(" warnings, "))
if self.errors==1:
self.fd.write(linkcheck._("1 error"))
self.fd.write(_("1 error"))
else:
self.fd.write(str(self.errors)+linkcheck._(" errors"))
self.fd.write(str(self.errors)+_(" errors"))
if linknumber >= 0:
if linknumber == 1:
self.fd.write(linkcheck._(" in 1 link"))
self.fd.write(_(" in 1 link"))
else:
self.fd.write(linkcheck._(" in %d links") % linknumber)
self.fd.write(linkcheck._(" found")+"\n<br>")
self.fd.write(_(" in %d links") % linknumber)
self.fd.write(_(" found")+"\n<br>")
self.stoptime = time.time()
duration = self.stoptime - self.starttime
name = linkcheck._("seconds")
self.fd.write(linkcheck._("Stopped checking at %s") % strtime(self.stoptime))
name = _("seconds")
self.fd.write(_("Stopped checking at %s") % strtime(self.stoptime))
if duration > 60:
duration = duration / 60
name = linkcheck._("minutes")
name = _("minutes")
if duration > 60:
duration = duration / 60
name = linkcheck._("hours")
name = _("hours")
self.fd.write(" (%.3f %s)\n" % (duration, name))
self.fd.write("</blockquote><br><hr noshade size=1><small>"+
linkcheck.Config.HtmlAppInfo+"<br>")
self.fd.write(linkcheck._("Get the newest version at %s\n") %\
('<a href="'+linkcheck.Config.Url+'" target=_top>'+linkcheck.Config.Url+
Config.HtmlAppInfo+"<br>")
self.fd.write(_("Get the newest version at %s\n") %\
('<a href="'+Config.Url+'" target=_top>'+Config.Url+
"</a>.<br>"))
self.fd.write(linkcheck._("Write comments and bugs to %s\n\n") %\
('<a href="mailto:'+linkcheck.Config.Email+'">'+linkcheck.Config.Email+"</a>."))
self.fd.write(_("Write comments and bugs to %s\n\n") %\
('<a href="mailto:'+Config.Email+'">'+Config.Email+"</a>."))
self.fd.write("</small></body></html>")
self.fd.flush()
self.fd = None

View file

@ -15,9 +15,9 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from StandardLogger import StandardLogger
import time, linkcheck, linkcheck.Config
import time
from linkcheck.log import strtime
from linkcheck import StringUtil
from linkcheck import StringUtil, _, Config
class SQLLogger (StandardLogger):
""" SQL output for PostgreSQL, not tested"""
@ -30,11 +30,11 @@ class SQLLogger (StandardLogger):
if self.fd is None: return
self.starttime = time.time()
if self.logfield("intro"):
self.fd.write("-- "+(linkcheck._("created by %s at %s\n") % (linkcheck.Config.AppName,
self.fd.write("-- "+(_("created by %s at %s\n") % (Config.AppName,
strtime(self.starttime))))
self.fd.write("-- "+(linkcheck._("Get the newest version at %s\n") % linkcheck.Config.Url))
self.fd.write("-- "+(linkcheck._("Write comments and bugs to %s\n\n") % \
linkcheck.Config.Email))
self.fd.write("-- "+(_("Get the newest version at %s\n") % Config.Url))
self.fd.write("-- "+(_("Write comments and bugs to %s\n\n") % \
Config.Email))
self.fd.flush()
def newUrl (self, urlData):
@ -70,15 +70,15 @@ class SQLLogger (StandardLogger):
if self.logfield("outro"):
self.stoptime = time.time()
duration = self.stoptime - self.starttime
name = linkcheck._("seconds")
self.fd.write("-- "+linkcheck._("Stopped checking at %s") % \
name = _("seconds")
self.fd.write("-- "+_("Stopped checking at %s") % \
strtime(self.stoptime))
if duration > 60:
duration = duration / 60
name = linkcheck._("minutes")
name = _("minutes")
if duration > 60:
duration = duration / 60
name = linkcheck._("hours")
name = _("hours")
self.fd.write(" (%.3f %s)\n" % (duration, name))
self.fd.flush()
self.fd = None

View file

@ -4,7 +4,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: Sun Jan 5 16:50:27 2003\n"
"POT-Creation-Date: Sun Jan 5 17:15:46 2003\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Bastian Kleineidam <calvin@users.sourceforge.net>\n"
"Language-Team: LANGUAGE <de@li.org>\n"

View file

@ -4,7 +4,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: Sun Jan 5 16:50:27 2003\n"
"POT-Creation-Date: Sun Jan 5 17:15:46 2003\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <fr@li.org>\n"

View file

@ -4,7 +4,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: Sun Jan 5 16:50:27 2003\n"
"POT-Creation-Date: Sun Jan 5 17:15:46 2003\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Hans Bausewein <hans.bausewein@comerwell.xs4all.nl>\n"
"Language-Team: LANGUAGE <nl@li.org>\n"