Pārlūkot izejas kodu

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

pull/24/head
Ben Kurtovic pirms 10 gadiem
vecāks
revīzija
cf66804fe5
2 mainītis faili ar 7 papildinājumiem un 2 dzēšanām
  1. +3
    -2
      copyvios/checker.py
  2. +4
    -0
      templates/index.mako

+ 3
- 2
copyvios/checker.py Parādīt failu

@@ -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 Parādīt failu

@@ -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>


Notiek ielāde…
Atcelt
Saglabāt