Skip to content
Myr

deprecate total_seconds

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parent f3ed132 · Browse files · 3 files+13 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+13 added−2 removed

  • other:+13 added−2 removed

3 files+13 added−2 removed

modified:src/flask/helpers.py+10 added
707 unmodified lines
708 :param timedelta td: the timedelta to be converted in seconds709710 :returns: number of seconds711 :rtype: int712713 .. deprecated:: 2.0714 Will be removed in Flask 2.1. Use715 :meth:`timedelta.total_seconds` instead.716 """717 warnings.warn(718 "'total_seconds' is deprecated and will be removed in Flask"719 " 2.1. Use 'timedelta.total_seconds' instead.",720 DeprecationWarning,721 stacklevel=2,722 )723 return td.days * 60 * 60 * 24 + td.seconds724725726def is_ip(value):
64 unmodified lines
modified:src/flask/sessions.py+1 added-2 removed
6 unmodified lines
7from itsdangerous import URLSafeTimedSerializer8from werkzeug.datastructures import CallbackDict910from .helpers import is_ip11from .helpers import total_seconds11from .json.tag import TaggedJSONSerializer121314class SessionMixin(MutableMapping):
323 unmodified lines
338 return None339 val = request.cookies.get(self.get_cookie_name(app))340 if not val:341 return self.session_class()343 max_age = total_seconds(app.permanent_session_lifetime)342 max_age = int(app.permanent_session_lifetime.total_seconds())343 try:344 data = s.loads(val, max_age=max_age)345 return self.session_class(data)346 except BadSignature:
39 unmodified lines
modified:CHANGES.rst+2 added
70 unmodified lines
71 teardown functions. :pr:`3412`72- Support nesting blueprints. :issue:`593, 1548`, :pr:`3923`73- ``flask shell`` sets up tab and history completion like the default74 ``python`` shell if ``readline`` is installed. :issue:`3941`75- ``helpers.total_seconds()`` is deprecated. Use76 ``timedelta.total_seconds()`` instead. :pr:`3962`777879Version 1.1.280-------------
1011 unmodified lines