Преглед изворни кода

Fix bad URI error thing.

pull/24/head
Ben Kurtovic пре 10 година
родитељ
комит
d2dff9f05d
2 измењених фајлова са 7 додато и 10 уклоњено
  1. +1
    -1
      copyvios/checker.py
  2. +6
    -9
      templates/index.mako

+ 1
- 1
copyvios/checker.py Прегледај датотеку

@@ -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 Прегледај датотеку

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


Loading…
Откажи
Сачувај