ソースを参照

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

pull/24/head
Ben Kurtovic 10年前
コミット
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>


読み込み中…
キャンセル
保存