mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-23 23:54:44 +00:00
add missing imports
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@443 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
d779fa0b78
commit
1a403ac0b7
8 changed files with 46 additions and 33 deletions
|
|
@ -14,7 +14,9 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
import time
|
||||
import time, linkcheck
|
||||
from linkcheck import Config
|
||||
from linkcheck.log import strtime
|
||||
from StandardLogger import StandardLogger
|
||||
|
||||
class CSVLogger (StandardLogger):
|
||||
|
|
@ -30,7 +32,7 @@ class CSVLogger (StandardLogger):
|
|||
self.starttime = time.time()
|
||||
if self.logfield("intro"):
|
||||
self.fd.write("# "+(linkcheck._("created by %s at %s\n") % (Config.AppName,
|
||||
_strtime(self.starttime))))
|
||||
strtime(self.starttime))))
|
||||
self.fd.write("# "+(linkcheck._("Get the newest version at %s\n") % Config.Url))
|
||||
self.fd.write("# "+(linkcheck._("Write comments and bugs to %s\n\n") % \
|
||||
Config.Email))
|
||||
|
|
@ -80,7 +82,7 @@ class CSVLogger (StandardLogger):
|
|||
if self.logfield("outro"):
|
||||
duration = self.stoptime - self.starttime
|
||||
name = linkcheck._("seconds")
|
||||
self.fd.write("# "+linkcheck._("Stopped checking at %s") % _strtime(self.stoptime))
|
||||
self.fd.write("# "+linkcheck._("Stopped checking at %s") % strtime(self.stoptime))
|
||||
if duration > 60:
|
||||
duration = duration / 60
|
||||
name = linkcheck._("minutes")
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
import linkcheck
|
||||
from linkcheck.log import Spaces
|
||||
from StandardLogger import StandardLogger
|
||||
|
||||
class ColoredLogger (StandardLogger):
|
||||
|
|
|
|||
|
|
@ -14,7 +14,9 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
import time
|
||||
import time, linkcheck
|
||||
from linkcheck import Config
|
||||
from linkcheck.log import strtime
|
||||
from StandardLogger import StandardLogger
|
||||
|
||||
class GMLLogger (StandardLogger):
|
||||
|
|
@ -31,7 +33,7 @@ class GMLLogger (StandardLogger):
|
|||
self.starttime = time.time()
|
||||
if self.logfield("intro"):
|
||||
self.fd.write("# "+(linkcheck._("created by %s at %s\n") % (Config.AppName,
|
||||
_strtime(self.starttime))))
|
||||
strtime(self.starttime))))
|
||||
self.fd.write("# "+(linkcheck._("Get the newest version at %s\n") % Config.Url))
|
||||
self.fd.write("# "+(linkcheck._("Write comments and bugs to %s\n\n") % \
|
||||
Config.Email))
|
||||
|
|
@ -87,7 +89,7 @@ class GMLLogger (StandardLogger):
|
|||
duration = self.stoptime - self.starttime
|
||||
name = linkcheck._("seconds")
|
||||
self.fd.write("# "+linkcheck._("Stopped checking at %s") % \
|
||||
_strtime(self.stoptime))
|
||||
strtime(self.stoptime))
|
||||
if duration > 60:
|
||||
duration = duration / 60
|
||||
name = linkcheck._("minutes")
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@
|
|||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
from StandardLogger import StandardLogger
|
||||
import time
|
||||
from linkcheck import Config
|
||||
from linkcheck.log import strtime
|
||||
import time, linkcheck
|
||||
|
||||
HTML_HEADER = """<!DOCTYPE html PUBLIC "-//W3C//DTD html 4.0//EN">
|
||||
<html><head><title>%s</title>
|
||||
|
|
@ -52,7 +54,7 @@ class HtmlLogger (StandardLogger):
|
|||
if self.logfield('intro'):
|
||||
self.fd.write("<center><h2>"+Config.App+"</h2></center>"+
|
||||
"<br><blockquote>"+Config.Freeware+"<br><br>"+
|
||||
(linkcheck._("Start checking at %s\n") % _strtime(self.starttime))+
|
||||
(linkcheck._("Start checking at %s\n") % strtime(self.starttime))+
|
||||
"<br><br>")
|
||||
self.fd.flush()
|
||||
|
||||
|
|
@ -140,7 +142,7 @@ class HtmlLogger (StandardLogger):
|
|||
self.stoptime = time.time()
|
||||
duration = self.stoptime - self.starttime
|
||||
name = linkcheck._("seconds")
|
||||
self.fd.write(linkcheck._("Stopped checking at %s") % _strtime(self.stoptime))
|
||||
self.fd.write(linkcheck._("Stopped checking at %s") % strtime(self.stoptime))
|
||||
if duration > 60:
|
||||
duration = duration / 60
|
||||
name = linkcheck._("minutes")
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@
|
|||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
from StandardLogger import StandardLogger
|
||||
import time, linkcheck
|
||||
from linkcheck.log import strtime
|
||||
from linkcheck import Config
|
||||
|
||||
class SQLLogger (StandardLogger):
|
||||
""" SQL output for PostgreSQL, not tested"""
|
||||
|
|
@ -29,7 +32,7 @@ class SQLLogger (StandardLogger):
|
|||
self.starttime = time.time()
|
||||
if self.logfield("intro"):
|
||||
self.fd.write("-- "+(linkcheck._("created by %s at %s\n") % (Config.AppName,
|
||||
_strtime(self.starttime))))
|
||||
strtime(self.starttime))))
|
||||
self.fd.write("-- "+(linkcheck._("Get the newest version at %s\n") % Config.Url))
|
||||
self.fd.write("-- "+(linkcheck._("Write comments and bugs to %s\n\n") % \
|
||||
Config.Email))
|
||||
|
|
@ -42,18 +45,18 @@ class SQLLogger (StandardLogger):
|
|||
"valid,url,line,name,checktime,downloadtime,cached) values "
|
||||
"(%s,%d,%s,%s,%s,%s,%s,%s,%d,%s,%d,%s,%d,%d,%d)%s\n" % \
|
||||
(self.dbname,
|
||||
StringUtil.sqlify(urlData.urlName),
|
||||
linkcheck.StringUtil.sqlify(urlData.urlName),
|
||||
urlData.recursionLevel,
|
||||
StringUtil.sqlify(urlData.parentName),
|
||||
StringUtil.sqlify(urlData.baseRef),
|
||||
StringUtil.sqlify(urlData.errorString),
|
||||
StringUtil.sqlify(urlData.validString),
|
||||
StringUtil.sqlify(urlData.warningString),
|
||||
StringUtil.sqlify(urlData.infoString),
|
||||
linkcheck.StringUtil.sqlify(urlData.parentName),
|
||||
linkcheck.StringUtil.sqlify(urlData.baseRef),
|
||||
linkcheck.StringUtil.sqlify(urlData.errorString),
|
||||
linkcheck.StringUtil.sqlify(urlData.validString),
|
||||
linkcheck.StringUtil.sqlify(urlData.warningString),
|
||||
linkcheck.StringUtil.sqlify(urlData.infoString),
|
||||
urlData.valid,
|
||||
StringUtil.sqlify(urlData.url),
|
||||
linkcheck.StringUtil.sqlify(urlData.url),
|
||||
urlData.line,
|
||||
StringUtil.sqlify(urlData.name),
|
||||
linkcheck.StringUtil.sqlify(urlData.name),
|
||||
urlData.checktime,
|
||||
urlData.downloadtime,
|
||||
urlData.cached,
|
||||
|
|
@ -67,7 +70,7 @@ class SQLLogger (StandardLogger):
|
|||
duration = self.stoptime - self.starttime
|
||||
name = linkcheck._("seconds")
|
||||
self.fd.write("-- "+linkcheck._("Stopped checking at %s") % \
|
||||
_strtime(self.stoptime))
|
||||
strtime(self.stoptime))
|
||||
if duration > 60:
|
||||
duration = duration / 60
|
||||
name = linkcheck._("minutes")
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
import sys, time, linkcheck
|
||||
from Logger import Logger
|
||||
from linkcheck import Config
|
||||
from linkcheck.log import LogFields, Spaces
|
||||
from linkcheck.log import LogFields, Spaces, strtime, MaxIndent
|
||||
|
||||
class StandardLogger (Logger):
|
||||
"""Standard text logger.
|
||||
|
|
@ -72,7 +72,7 @@ __init__(self, **args)
|
|||
self.fd.write("%s\n%s\n" % (Config.AppInfo, Config.Freeware))
|
||||
self.fd.write(linkcheck._("Get the newest version at %s\n") % Config.Url)
|
||||
self.fd.write(linkcheck._("Write comments and bugs to %s\n\n") % Config.Email)
|
||||
self.fd.write(linkcheck._("Start checking at %s\n") % linkcheck.log._strtime(self.starttime))
|
||||
self.fd.write(linkcheck._("Start checking at %s\n") % linkcheck.log.strtime(self.starttime))
|
||||
self.fd.flush()
|
||||
|
||||
|
||||
|
|
@ -102,15 +102,15 @@ __init__(self, **args)
|
|||
linkcheck._("%.3f seconds\n") % urlData.checktime)
|
||||
if urlData.infoString and self.logfield('info'):
|
||||
self.fd.write(linkcheck._(LogFields["info"])+Spaces["info"]+
|
||||
StringUtil.indent(
|
||||
StringUtil.blocktext(urlData.infoString, 65),
|
||||
linkcheck.StringUtil.indent(
|
||||
linkcheck.StringUtil.blocktext(urlData.infoString, 65),
|
||||
MaxIndent)+"\n")
|
||||
if urlData.warningString:
|
||||
#self.warnings += 1
|
||||
if self.logfield('warning'):
|
||||
self.fd.write(linkcheck._(LogFields["warning"])+Spaces["warning"]+
|
||||
StringUtil.indent(
|
||||
StringUtil.blocktext(urlData.warningString, 65),
|
||||
linkcheck.StringUtil.indent(
|
||||
linkcheck.StringUtil.blocktext(urlData.warningString, 65),
|
||||
MaxIndent)+"\n")
|
||||
|
||||
if self.logfield('result'):
|
||||
|
|
@ -144,7 +144,7 @@ __init__(self, **args)
|
|||
self.stoptime = time.time()
|
||||
duration = self.stoptime - self.starttime
|
||||
name = linkcheck._("seconds")
|
||||
self.fd.write(linkcheck._("Stopped checking at %s") % linkcheck.log._strtime(self.stoptime))
|
||||
self.fd.write(linkcheck._("Stopped checking at %s") % linkcheck.log.strtime(self.stoptime))
|
||||
if duration > 60:
|
||||
duration = duration / 60
|
||||
name = linkcheck._("minutes")
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@
|
|||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
import time, linkcheck
|
||||
from linkcheck import Config
|
||||
from linkcheck.StringUtil import xmlify
|
||||
from linkcheck.log import strtime
|
||||
from StandardLogger import StandardLogger
|
||||
|
||||
class XMLLogger (StandardLogger):
|
||||
|
|
@ -33,7 +35,7 @@ class XMLLogger (StandardLogger):
|
|||
if self.logfield("intro"):
|
||||
self.fd.write("<!--\n")
|
||||
self.fd.write(" "+linkcheck._("created by %s at %s\n") % \
|
||||
(Config.AppName, _strtime(self.starttime)))
|
||||
(Config.AppName, strtime(self.starttime)))
|
||||
self.fd.write(" "+linkcheck._("Get the newest version at %s\n") % Config.Url)
|
||||
self.fd.write(" "+linkcheck._("Write comments and bugs to %s\n\n") % \
|
||||
Config.Email)
|
||||
|
|
@ -96,7 +98,7 @@ class XMLLogger (StandardLogger):
|
|||
duration = self.stoptime - self.starttime
|
||||
name = linkcheck._("seconds")
|
||||
self.fd.write("<!-- ")
|
||||
self.fd.write(linkcheck._("Stopped checking at %s") % _strtime(self.stoptime))
|
||||
self.fd.write(linkcheck._("Stopped checking at %s") % strtime(self.stoptime))
|
||||
if duration > 60:
|
||||
duration = duration / 60
|
||||
name = linkcheck._("minutes")
|
||||
|
|
|
|||
|
|
@ -15,6 +15,10 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
# return formatted time
|
||||
def strtime (t):
|
||||
return time.strftime("%d.%m.%Y %H:%M:%S", time.localtime(t))
|
||||
|
||||
import time, linkcheck
|
||||
|
||||
LogFields = {
|
||||
|
|
@ -59,7 +63,3 @@ Loggers = {
|
|||
# for easy printing: a comma separated logger list
|
||||
LoggerKeys = reduce(lambda x, y: x+", "+y, Loggers.keys())
|
||||
|
||||
# return formatted time
|
||||
def _strtime (t):
|
||||
return time.strftime("%d.%m.%Y %H:%M:%S", time.localtime(t))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue