Commit 16c75a95 authored by Vincent Pelletier's avatar Vincent Pelletier

Toward Python3: str/None comparison

parent cd057e1d
......@@ -82,6 +82,7 @@ AUTO_PERIOD_COEF = 200
# Larger (x < LARGER_THAN_INTEGER_STR == True) than any string starting with
# a number
LARGER_THAN_INTEGER_STR = 'A'
SMALLER_THAN_INTEGER_STR = ''
def statusIsError(status):
return status[0] > '3'
......@@ -997,7 +998,7 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict,
'<tr><th>date</th><th>hits</th></tr>' % period)
hit_per_day = defaultdict(int)
x_min = LARGER_THAN_INTEGER_STR
x_max = None
x_max = SMALLER_THAN_INTEGER_STR
for site_data in per_site.itervalues():
apdex_data_list = site_data.getApdexData()
if apdex_data_list:
......@@ -1007,6 +1008,7 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict,
hit_per_day[decimator(hit_date)] += hit
if x_min == LARGER_THAN_INTEGER_STR:
x_min = None
x_max = None
for hit_date, hit in sorted(hit_per_day.iteritems(), key=ITEMGETTER0):
out.write('<tr><td>%s</td><td>%s</td></tr>' % (hit_date, hit))
out.write('</table>')
......@@ -1330,9 +1332,9 @@ def main():
continue
hit_date = asDate(match.group('timestamp'))
if to_next_period is not None:
if hit_date > latest_date: # '' > None is True
if latest_date is None or latest_date < hit_date:
latest_date = hit_date
if hit_date < earliest_date or earliest_date is None:
if earliest_date is None or hit_date < earliest_date:
earliest_date = hit_date
next_period = getNextPeriod()
try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment