Skip to content

fix debug log message when userid is None#3814

Open
eyetheekh wants to merge 1 commit intoPylons:mainfrom
eyetheekh:fix/authenticated_userid_debug_logging
Open

fix debug log message when userid is None#3814
eyetheekh wants to merge 1 commit intoPylons:mainfrom
eyetheekh:fix/authenticated_userid_debug_logging

Conversation

@eyetheekh
Copy link

summary

The log message formats the string using % userid, but the string does not contain a formatting placeholder, which causes:

TypeError: not all arguments converted during string formatting

This removes the % userid from the log message since its None anyway.

to reproduce

from pyramid.authentication import RepozeWho1AuthenticationPolicy class DummyRequest: environ = {"repoze.who.identity": {"repoze.who.userid": None}} def _log(msg, methodname, request): print(msg) policy = RepozeWho1AuthenticationPolicy() policy.debug = True policy._log = _log request = DummyRequest() result = policy.authenticated_userid(request) # raises type error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant