summaryrefslogtreecommitdiff
path: root/webapp.py
diff options
context:
space:
mode:
Diffstat (limited to 'webapp.py')
-rwxr-xr-xwebapp.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/webapp.py b/webapp.py
index 86d14f0..3820cf9 100755
--- a/webapp.py
+++ b/webapp.py
@@ -1,5 +1,6 @@
#!/usr/bin/python
+import binascii
import datetime
import os.path
import sqlite3
@@ -210,7 +211,7 @@ def generate_shared(rows):
funcdict = dict()
entry = dict(filename1=filename1, filename2=filename2, size1=size1,
size2=size2, functions=funcdict)
- funcdict[funccomb] = hashvalue
+ funcdict[funccomb] = binascii.b2a_hex(hashvalue)
if entry:
yield entry
@@ -317,6 +318,7 @@ class Application(object):
files.clear()
cursize = size
+ hashvalue = binascii.b2a_hex(hashvalue)
if hashvalue in files:
files[hashvalue]["filenames"].add(filename)
continue
@@ -329,7 +331,7 @@ class Application(object):
(cid, package2))
for func1, hashvalue, func2, filename in fetchiter(cur2):
entry["matches"].setdefault(filename, {})[func1, func2] = \
- hashvalue
+ binascii.b2a_hex(hashvalue)
cur2.close()
cur.close()
@@ -351,9 +353,13 @@ class Application(object):
return html_response(detail_template.stream(params))
def show_hash(self, function, hashvalue):
+ try:
+ bhash = buffer(binascii.a2b_hex(hashvalue))
+ except TypeError:
+ raise NotFound()
cur = self.db.cursor()
cur.execute("SELECT content.package, content.filename, content.size, hash.function FROM content JOIN hash ON content.id = hash.cid WHERE hash = ?;",
- (hashvalue,))
+ (bhash,))
entries = [dict(package=package, filename=filename, size=size,
function=otherfunc)
for package, filename, size, otherfunc in fetchiter(cur)