Better sanitization on templates and datatables output.

This commit is contained in:
Tim 2015-12-06 14:09:38 +02:00
parent 1157fda96c
commit b0fa0d534e
7 changed files with 206 additions and 196 deletions

View file

@ -155,7 +155,7 @@ def human_duration(s):
h = int((s % 84600) / 3600)
m = int(((s % 84600) % 3600) / 60)
s = int(((s % 84600) % 3600) % 60)
hd_list = []
if d > 0:
hd_list.append(str(d) + ' days')
@ -165,7 +165,7 @@ def human_duration(s):
hd_list.append(str(m) + ' mins')
if s > 0:
hd_list.append(str(s) + ' secs')
hd = ' '.join(hd_list)
return hd
@ -204,7 +204,7 @@ def piratesize(size):
split = size.split(" ")
factor = float(split[0])
unit = split[1].upper()
if unit == 'MiB':
size = factor * 1048576
elif unit == 'MB':
@ -433,6 +433,6 @@ def process_json_kwargs(json_kwargs):
def sanitize(string):
if string:
return str(string).replace('<','&lt;').replace('>','&gt;')
return unicode(string).replace('<','&lt;').replace('>','&gt;')
else:
return ''
return ''