ajenti / ajenti

Formatted string passed to logging module PYL-W1203
Performance
Minor
3 months ago2 years old
Use lazy % formatting in logging functions
 96                    'traceback': str(getattr(e, 'traceback_str', '')),
 97                }
 98            except SecurityError as e:
 99                logging.warning(f'Security error at {context.path}: {e.message}')100                if page:
101                    raise
102                status  = 403
Use lazy % formatting in logging functions
 46        pass
 47
 48    def handle(self, http_context):
 49        logging.warning(f'URL not found: {http_context.path}') 50        http_context.respond_not_found()
 51        
 52        with open(os.path.dirname(__file__)+'/static/images/error.jpeg', "rb") as error_image:
Use lazy % formatting in logging functions
 17        pass
 18
 19    def handle(self, http_context):
 20        logging.warning(f'Invalid client certificate : ' 21                        f'{http_context.env["SSL_CLIENT_DIGEST"]}'
 22        )
 23        http_context.respond_unauthenticated()
Use lazy % formatting in logging functions
229        if demote:
230            uid = self.get_provider().get_isolation_uid(username)
231            gid = self.get_provider().get_isolation_gid(username)
232            logging.debug(233                f'Authentication provider "{self.get_provider().name}" maps "{username}" -> {uid:d}'
234            )
235            self.context.worker.demote(uid, gid)
Use lazy % formatting in logging functions
217        return self.context.identity
218
219    def login(self, username, demote=True):
220        logging.info(f'Authenticating session as {username}')221        syslog.syslog(
222            syslog.LOG_NOTICE | syslog.LOG_AUTH,
223            f'{username} has logged in from {self.context.session.client_info["address"]}'