doc(util): Document the TimezoneGTM class
This commit is contained in:
@@ -29,3 +29,6 @@ Miscellaneous
|
||||
|
||||
.. automodule:: falcon.util
|
||||
:members: deprecated, dt_to_http, http_date_to_dt, to_query_str
|
||||
|
||||
.. autoclass:: falcon.util.TimezoneGMT
|
||||
:members:
|
||||
|
||||
@@ -2,15 +2,43 @@ import datetime
|
||||
|
||||
|
||||
class TimezoneGMT(datetime.tzinfo):
|
||||
"""Used in cookie response formatting"""
|
||||
"""GMT timezone class implementing the :py:class:`datetime.tzinfo` interface."""
|
||||
|
||||
GMT_ZERO = datetime.timedelta(hours=0)
|
||||
|
||||
def utcoffset(self, dt):
|
||||
"""Get the offset from UTC.
|
||||
|
||||
Args:
|
||||
dt(datetime.datetime): Ignored
|
||||
|
||||
Returns:
|
||||
datetime.timedelta: GMT offset, which is equivalent to UTC and
|
||||
so is aways 0.
|
||||
"""
|
||||
|
||||
return self.GMT_ZERO
|
||||
|
||||
def tzname(self, dt):
|
||||
"""Get the name of this timezone.
|
||||
|
||||
Args:
|
||||
dt(datetime.datetime): Ignored
|
||||
|
||||
Returns:
|
||||
str: "GMT"
|
||||
"""
|
||||
|
||||
return "GMT"
|
||||
|
||||
def dst(self, dt):
|
||||
"""Return the daylight saving time (DST) adjustment.
|
||||
|
||||
Args:
|
||||
dt(datetime.datetime): Ignored
|
||||
|
||||
Returns:
|
||||
datetime.timedelta: DST adjustment for GMT, which is always 0.
|
||||
"""
|
||||
|
||||
return self.GMT_ZERO
|
||||
|
||||
Reference in New Issue
Block a user