浏览代码

Give a different error message for timeouts. Cheating a bit.

pull/24/head
Ben Kurtovic 9 年前
父节点
当前提交
cf66804fe5
共有 2 个文件被更改,包括 7 次插入2 次删除
  1. +3
    -2
      copyvios/checker.py
  2. +4
    -0
      templates/index.mako

+ 3
- 2
copyvios/checker.py 查看文件

@@ -51,9 +51,10 @@ def _get_results(query, follow=True):
if urlparse(query.url).scheme not in ["http", "https"]:
query.error = "bad URI"
return
result = page.copyvio_compare(query.url)
max_time = 30
result = page.copyvio_compare(query.url, max_time=max_time)
if result.source_chain is page.EMPTY:
query.error = "no data"
query.error = "timeout" if result.time > max_time else "no data"
return
query.result = result
query.result.cached = False


+ 4
- 0
templates/index.mako 查看文件

@@ -11,6 +11,10 @@
<div id="info-box" class="red-box">
<p>Couldn't find any text in <a href="${query.url | h}">${query.url | h}</a>. <i>Note:</i> only HTML and plain text pages are supported, and content generated by JavaScript or found inside iframes is ignored.</p>
</div>
% elif query.error == "timeout":
<div id="info-box" class="red-box">
<p>The URL <a href="${query.url | h}">${query.url | h}</a> timed out before any data could be retrieved.</p>
</div>
% elif not query.site:
<div id="info-box" class="red-box">
<p>The given site (project=<b><span class="mono">${query.project | h}</span></b>, language=<b><span class="mono">${query.lang | h}</span></b>) doesn't seem to exist. It may also be closed or private. <a href="//${query.lang | h}.${query.project | h}.org/">Confirm its URL.</a></p>


正在加载...
取消
保存