Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mentors.debian.net
debexpo
Commits
8182a349
Verified
Commit
8182a349
authored
Sep 26, 2021
by
Baptiste Beauplat
Browse files
Explicitly add _num_days and _today method to EmailChangeTokenGenerator (removed in django3)
parent
7d87726d
Changes
1
Hide whitespace changes
Inline
Side-by-side
debexpo/tools/token.py
View file @
8182a349
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
# OTHER DEALINGS IN THE SOFTWARE.
from
datetime
import
date
from
django.conf
import
settings
from
django.conf
import
settings
from
django.utils.crypto
import
constant_time_compare
,
salted_hmac
from
django.utils.crypto
import
constant_time_compare
,
salted_hmac
...
@@ -87,5 +88,12 @@ class EmailChangeTokenGenerator(PasswordResetTokenGenerator):
...
@@ -87,5 +88,12 @@ class EmailChangeTokenGenerator(PasswordResetTokenGenerator):
str
(
login_timestamp
)
+
\
str
(
login_timestamp
)
+
\
str
(
timestamp
)
str
(
timestamp
)
def
_num_days
(
self
,
dt
):
return
(
dt
-
date
(
2001
,
1
,
1
)).
days
def
_today
(
self
):
# Used for mocking in tests
return
date
.
today
()
# pragma: no cover
email_change_token_generator
=
EmailChangeTokenGenerator
()
email_change_token_generator
=
EmailChangeTokenGenerator
()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment