Mercurial > p > roundup > code
view website/issues/html/_generic.help-list.html @ 6823:fe0091279f50
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.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 07 Aug 2022 01:51:11 -0400 |
| parents | 7146b68ac263 |
| children | 28aa76443f58 |
line wrap: on
line source
<!-- vim: sw=2 ts=8 et --> <html tal:define="vok context/is_view_ok"> <head> <title>Search result for user helper</title> <link rel="stylesheet" type="text/css" href="@@file/style.css" /> <script language="Javascript" type="text/javascript" tal:attributes="nonce request/client/client_nonce" tal:content="structure string:<!-- // this is the name of the field in the original form that we're working on form = parent.opener.document.${request/form/form/value}; field = '${request/form/property/value}'; //-->"></script> <script src="@@file/help_controls.js" tal:attributes="nonce request/client/client_nonce" type="text/javascript"></script> <script type="text/javascript" tal:attributes="nonce request/client/client_nonce"><!-- var text_field = parent.submit.document.frm_help.text_preview; //--></script> </head> <body> <pre tal:content="request/env/QUERY_STRING" tal:condition=false /> <p tal:condition="not:vok" i18n:translate="">You are not allowed to view this page.</p> <tal:if condition="context/is_view_ok"> <tal:def define="batch request/batch;"> <form name=dummyform> <table width="100%" tal:define="template string:help-list" metal:use-macro="templates/help/macros/batch_navi" > <tr class="navigation"> <th> <a href="#"><< previous</a> </th> <th i18n:translate="">1..25 out of 50 </th> <th> <a href="#">next >></a> </th> </tr> </table> <form name=dummyform> <table class="classhelp" tal:define=" props python:request.form['properties'].value.split(','); legend templates/help/macros/legend; "><thead> <tr metal:use-macro="legend"> <th> <b>x</b></th> <th tal:repeat="prop props" tal:content="prop" i18n:translate=""></th> </tr> </thead> <tfoot tal:condition=true> <tr metal:use-macro="legend" /> </tfoot> <tbody> <tr tal:repeat="item batch"> <tal:block tal:define="attr python:item[props[0]]" > <td> <input name="check" onclick="switch_val(text_field, this);" type="checkbox" tal:attributes="value attr; id string:id_$attr" /> </td> <td tal:repeat="prop props"> <label class="classhelp-label" tal:attributes="for string:id_$attr" tal:content="python:item[prop]"></label> </td> </tal:block> </tr> </tbody> </table> </form> </tal:def> </tal:if> <pre tal:content=request tal:condition=false /> <script type="text/javascript" tal:attributes="nonce request/client/client_nonce"><!-- parent.submit.document.frm_help.cb_listpresent.checked=true; reviseList_framed(document.dummyform, text_field) //--></script> </body> </html> <!-- SHA: 7581a18984d95c2c415df046cfbdda73ad95651e -->
