analytics: Disallow non-UTC fill times in process_count_stat.

No change in behavior, but we aren't supporting non-UTC times in analytics
as a whole any more, so might as well change this check as well.
This commit is contained in:
Rishi Gupta
2017-10-04 17:06:43 -07:00
committed by Tim Abbott
parent 0596c4a810
commit c7bdabbda8
2 changed files with 5 additions and 6 deletions

View File

@@ -8,7 +8,7 @@ from analytics.models import InstallationCount, RealmCount, \
from zerver.models import Realm, UserProfile, Message, Stream, \
UserActivityInterval, RealmAuditLog, models
from zerver.lib.timestamp import floor_to_day, floor_to_hour, ceiling_to_day, \
ceiling_to_hour
ceiling_to_hour, verify_UTC
from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Type, Union
@@ -78,8 +78,7 @@ def process_count_stat(stat, fill_to_time):
else:
raise AssertionError("Unknown frequency: %s" % (stat.frequency,))
if fill_to_time.tzinfo is None:
raise ValueError("fill_to_time must be timezone aware: %s" % (fill_to_time,))
verify_UTC(fill_to_time)
if floor_to_hour(fill_to_time) != fill_to_time:
raise ValueError("fill_to_time must be on an hour boundary: %s" % (fill_to_time,))