http://hg.code.sf.net:8000/p/roundup/code/atom-log/tip/roundup/backends/sessions_common.py Mercurial Repository: p/roundup/code: roundup/backends/sessions_common.py history 2026-04-25T18:05:41-04:00 chore(ruff): refine imports and spacing fix. http://hg.code.sf.net:8000/p/roundup/code/#changeset-be128eb0a4e19740fa096010899d3eb29961b652 John Rouillard rouilj@ieee.org 2026-04-25T18:05:41-04:00 2026-04-25T18:05:41-04:00
changeset be128eb0a4e1
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description chore(ruff): refine imports and spacing fix.
files
Modify unique token to use url safe characters. http://hg.code.sf.net:8000/p/roundup/code/#changeset-b04e44db7d8d38964551f9730628748ebaa4e7ee John Rouillard rouilj@ieee.org 2022-08-07T03:33:35-04:00 2022-08-07T03:33:35-04:00
changeset b04e44db7d8d
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description Modify unique token to use url safe characters.

Looks like the merge of the methods I chose cause url unsafe / to be
emitted sometimes. This causes poe post to fail as the url includes
the key and the / messes up the rest route url parsing code.
files
Refactor session db logging and key generation for sessions/otks http://hg.code.sf.net:8000/p/roundup/code/#changeset-fe0091279f507de2e77032a13ac13d031832c36c John Rouillard rouilj@ieee.org 2022-08-07T01:51:11-04:00 2022-08-07T01:51:11-04:00
changeset fe0091279f50
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description Refactor session db logging and key generation for sessions/otks

While I was working on the redis sessiondb stuff, I noticed that
log_wanrning, get_logger ... was duplicated. Also there was code to
generate a unique key for otks that was duplicated.

Changes:

creating new sessions_common.py and SessionsCommon class to provide
methods:

log_warning, log_info, log_debug, get_logger, getUniqueKey

getUniqueKey method is closer to the method used to make
session keys in client.py.

sessions_common.py now report when random_.py chooses a weak
random number generator. Removed same from rest.py.

get_logger reconciles all logging under

roundup.hyperdb.backends.<name of BasicDatabase class>

some backends used to log to root logger.


have BasicDatabase in other sessions_*.py modules inherit from
SessionCommon.

change logging to use log_* methods.


In addition:

remove unused imports reported by flake8 and other formatting
changes

modify actions.py, rest.py, templating.py to use getUniqueKey
method.

add tests for new methods

test_redis_session.py
swap out ModuleNotFoundError for ImportError to prevent crash in
python2 when redis is not present.

allow injection of username:password or just password into redis
connection URL. set pytest_redis_pw envirnment variable to password
or user:password when running test.
files