zerver/models.py: Fix last_reminder_tzaware annotation.

Fix annotated return type of UserProfile.last_reminder_tzaware from
`str` to `Optional[datetime.datetime]`.
This commit is contained in:
Eklavya Sharma 2016-06-12 15:33:05 +05:30 committed by Tim Abbott
parent 8acc51218e
commit 0cc7a6583c
1 changed files with 3 additions and 3 deletions

View File

@ -456,10 +456,10 @@ class UserProfile(AbstractBaseUser, PermissionsMixin):
return False return False
def last_reminder_tzaware(self): def last_reminder_tzaware(self):
# type: () -> str # type: () -> Optional[datetime.datetime]
if self.last_reminder is not None and timezone.is_naive(self.last_reminder): if self.last_reminder is not None and timezone.is_naive(self.last_reminder):
logging.warning("Loaded a user_profile.last_reminder for user %s that's not tz-aware: %s" logging.warning(u"Loaded a user_profile.last_reminder for user %s that's not tz-aware: %s"
% (self.email, self.last_reminder)) % (self.email, text_type(self.last_reminder)))
return self.last_reminder.replace(tzinfo=timezone.utc) return self.last_reminder.replace(tzinfo=timezone.utc)
return self.last_reminder return self.last_reminder