mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-31 21:20:28 +00:00
fixed cgi check run
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1593 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
98858c7822
commit
41beea6ee3
1 changed files with 14 additions and 7 deletions
|
|
@ -57,15 +57,17 @@ def checkaccess (out=sys.stdout, hosts=[], servers=[], env=os.environ):
|
|||
|
||||
def checklink (out=sys.stdout, form={}, env=os.environ):
|
||||
"""main cgi function, check the given links and print out the result"""
|
||||
try: checkform(form)
|
||||
try:
|
||||
checkform(form)
|
||||
except FormError, why:
|
||||
logit(form, env)
|
||||
print_error(out, why)
|
||||
return
|
||||
import linkcheck.configuration
|
||||
config = linkcheck.configuration.Configuration()
|
||||
config["recursionlevel"] = int(form["level"].value)
|
||||
config["log"] = config.newLogger('html', {'fd': out})
|
||||
config.setThreads(0)
|
||||
config["logger"] = config.logger_new('html', fd=out)
|
||||
config["threads"] = 0
|
||||
if form.has_key('externstrictall'):
|
||||
config['externstrictall'] = True
|
||||
if form.has_key("anchors"):
|
||||
|
|
@ -81,11 +83,16 @@ def checklink (out=sys.stdout, form={}, env=os.environ):
|
|||
config["externlinks"].append(
|
||||
linkcheck.get_link_pat("^%s$" % linkcheck.url.safe_url_pattern))
|
||||
config["externlinks"].append(linkcheck.get_link_pat(".*", strict=True))
|
||||
# start checking
|
||||
import linkcheck.checker
|
||||
config.appendUrl(
|
||||
linkcheck.checker.get_url_from(form["url"].value, 0, config))
|
||||
linkcheck.checkUrls(config)
|
||||
import linkcheck.checker.cache
|
||||
import linkcheck.checker.consumer
|
||||
cache = linkcheck.checker.cache.Cache()
|
||||
consumer = linkcheck.checker.consumer.Consumer(config, cache)
|
||||
# start checking
|
||||
url = form["url"].value
|
||||
url_data = linkcheck.checker.get_url_from(url, 0, consumer))
|
||||
consumer.append_url(url_data)
|
||||
linkcheck.checker.check_urls(consumer)
|
||||
|
||||
|
||||
def get_host_name (form):
|
||||
|
|
|
|||
Loading…
Reference in a new issue