Przeglądaj źródła

Fix bad URI error thing.

pull/24/head
Ben Kurtovic 10 lat temu
rodzic
commit
d2dff9f05d
2 zmienionych plików z 7 dodań i 10 usunięć
  1. +1
    -1
      copyvios/checker.py
  2. +6
    -9
      templates/index.mako

+ 1
- 1
copyvios/checker.py Wyświetl plik

@@ -35,7 +35,7 @@ def _get_results(query):

if query.url:
if urlparse(query.url).scheme not in ["http", "https"]:
query.result = "bad URI"
query.error = "bad URI"
return
query.result = page.copyvio_compare(query.url)
query.result.cached = False


+ 6
- 9
templates/index.mako Wyświetl plik

@@ -1,11 +1,13 @@
<%!
from flask import g, request
%>\
<%! from flask import g, request %>\
<%include file="/support/header.mako" args="title='Earwig\'s Copyvio Detector'"/>
<%namespace module="copyvios.highlighter" import="highlight_delta"/>\
<%namespace module="copyvios.misc" import="urlstrip"/>\
% if query.project and query.lang and (query.title or query.oldid):
% if not query.site:
% if query.error == "bad URI":
<div id="info-box" class="red-box">
<p>Unsupported URI scheme: <a href="${query.url | h}">${query.url | h}</a>.</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>
</div>
@@ -17,11 +19,6 @@
<div id="info-box" class="red-box">
<p>The given revision ID doesn't seem to exist: <a href="//${query.site.domain | h}/w/index.php?oldid=${query.oldid | h}">${query.oldid | h}</a>.</p>
</div>
% elif query.url and result == "bad URI":
<% result = None %>
<div id="info-box" class="red-box">
<p>Unsupported URI scheme: <a href="${query.url | h}">${query.url | h}</a>.</p>
</div>
% endif
%endif
<p>This tool attempts to detect <a href="//en.wikipedia.org/wiki/WP:COPYVIO">copyright violations</a> in articles. Simply give the title of the page or ID of the revision you want to check and hit Submit. The tool will search for similar content elsewhere on the web using <a href="//info.yahoo.com/legal/us/yahoo/boss/pricing/">Yahoo! BOSS</a> and then display a report if a match is found. If you give a URL, it will skip the search engine step and directly display a report comparing the article to that particular webpage, like the <a href="//toolserver.org/~dcoetzee/duplicationdetector/">Duplication Detector</a>.</p>


Ładowanie…
Anuluj
Zapisz