Make PyLint happy with the models code

This commit is contained in:
2018-07-08 19:47:05 +02:00
parent 531faa1ce7
commit d14d32767c
3 changed files with 14 additions and 7 deletions

View File

@@ -115,6 +115,11 @@ class User(db.Model, UserMixin):
@property
def timezone(self):
"""The users time zone
If the user didnt set a time zone yet, the application default is used.
"""
from flask import current_app
from pytz import timezone
from pytz.exceptions import UnknownTimeZoneError
@@ -204,9 +209,9 @@ class Event(db.Model):
description = db.Column(db.UnicodeText())
def __as_tz(self, timestamp, as_timezone=None):
from pytz import timezone, UTC
from pytz import timezone, utc
utc_timestamp = UTC.localize(timestamp)
utc_timestamp = utc.localize(dt=timestamp)
return utc_timestamp.astimezone(as_timezone or timezone(self.time_zone))
@@ -240,7 +245,7 @@ class Event(db.Model):
return f'<Event {self.id} ({self.title}) of {self.user}>'
class UserSetting(db.Model):
class UserSetting(db.Model): # pylint: disable=too-few-public-methods
"""Database model for user settings
"""