Bläddra i källkod

Really fix checkbox blank value treatment.

pull/24/head
Ben Kurtovic 10 år sedan
förälder
incheckning
c6b9c9ebe6
3 ändrade filer med 8 tillägg och 8 borttagningar
  1. +2
    -2
      copyvios/checker.py
  2. +2
    -4
      copyvios/misc.py
  3. +4
    -2
      templates/index.mako

+ 2
- 2
copyvios/checker.py Visa fil

@@ -56,8 +56,8 @@ def _get_results(query, follow=True):
query.action = "compare" if query.url else "search"
if query.action == "search":
conn = get_cache_db()
use_engine = 1 if query.use_engine != "" else 0
use_links = 1 if query.use_links != "" else 0
use_engine = 0 if query.use_engine == "0" else 1
use_links = 0 if query.use_links == "0" else 1
if not use_engine and not use_links:
query.error = "no search method"
return


+ 2
- 4
copyvios/misc.py Visa fil

@@ -15,12 +15,10 @@ class Query(object):
def __init__(self, method="GET"):
self.query = {}
if method == "GET":
parsed = parse_qs(request.environ["QUERY_STRING"],
keep_blank_values=True)
parsed = parse_qs(request.environ["QUERY_STRING"])
elif method == "POST":
size = int(request.environ.get("CONTENT_LENGTH", 0))
parsed = parse_qs(request.environ["wsgi.input"].read(size),
keep_blank_values=True)
parsed = parse_qs(request.environ["wsgi.input"].read(size))
else:
parsed = {}
for key, value in parsed.iteritems():


+ 4
- 2
templates/index.mako Visa fil

@@ -105,9 +105,11 @@
</td>
<td id="cv-inner-col2"><label for="action-search">Copyvio&nbsp;search:</label></td>
<td id="cv-inner-col3">
<input id="cv-cb-engine" type="checkbox" name="use_engine" value="1" ${'checked="checked"' if (query.use_engine != "") else ""} />
<input type="hidden" name="use_engine" value="0" />
<input type="hidden" name="use_links" value="0" />
<input id="cv-cb-engine" type="checkbox" name="use_engine" value="1" ${'checked="checked"' if (query.use_engine != "0") else ""} />
<label for"cv-cb-engine">Use&nbsp;search&nbsp;engine</label>
<input id="cv-cb-links" type="checkbox" name="use_links" value="1" ${'checked="checked"' if (query.use_links != "") else ""} />
<input id="cv-cb-links" type="checkbox" name="use_links" value="1" ${'checked="checked"' if (query.use_links != "0") else ""} />
<label for="cv-cb-links">Use&nbsp;links&nbsp;in&nbsp;page</label>
</td>
</tr>


Laddar…
Avbryt
Spara