Mercurial > p > roundup > code
diff roundup/backends/back_anydbm.py @ 7211:506c86823abb
Add config argument to more password.Password invocations.
The work done to allow password_pbkdf2_default_rounds to be overridden
for testing requires that calls to password.Password include a config
argument.
This was needed because using the real value more than quadrupled
testing runtime.
However there are still a few places where config was not being set
when Password was called. I think this fixes all of the ones that are
called from a function that have access to a db.config object.
The remaining ones all call Password(encrypted=x). This results in
Password.unpack() being called. If x is not a propertly formatted
password string ("{scheme}...", it calls encodePassword. It then
should end up raising the ConfigNotSet exception. This is
probably what we want as it means the shape of "x" is not correct.
I don't understand why Password.unpack() attempts to encrypt the value
of encrypted if it doesn't match the right form. According to codecov,
this encryption branch is being used, so somewhere x is of the wrong
form. Hmmm....
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 04 Mar 2023 00:17:26 -0500 |
| parents | f524ddc27af8 |
| children | 9e612a39547a |
line wrap: on
line diff
--- a/roundup/backends/back_anydbm.py Fri Mar 03 18:18:26 2023 -0500 +++ b/roundup/backends/back_anydbm.py Sat Mar 04 00:17:26 2023 -0500 @@ -503,7 +503,7 @@ elif isinstance(prop, hyperdb.Interval) and v is not None: d[k] = date.Interval(v) elif isinstance(prop, hyperdb.Password) and v is not None: - d[k] = password.Password(encrypted=v) + d[k] = password.Password(encrypted=v, config=self.config) else: d[k] = v return d @@ -2147,7 +2147,8 @@ elif isinstance(prop, hyperdb.Interval): value = date.Interval(value) elif isinstance(prop, hyperdb.Password): - value = password.Password(encrypted=value) + value = password.Password(encrypted=value, + config=self.db.config) d[propname] = value # get a new id if necessary
