mirror of
https://github.com/pretix/pretix.git
synced 2026-09-25 18:14:41 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf92aa80ec |
@@ -151,30 +151,12 @@ class LoggingMixin:
|
||||
logentry = LogEntry(content_object=self, user=user, action_type=action, event=event,
|
||||
organizer_id=organizer_id, **kwargs)
|
||||
if isinstance(data, dict):
|
||||
# sensitivekeys are matched whether contained, not exactly
|
||||
sensitivekeys = [
|
||||
'token',
|
||||
'apikey',
|
||||
'_key',
|
||||
'password',
|
||||
'Password',
|
||||
'_pass',
|
||||
'secret',
|
||||
]
|
||||
sensitivekeys = ['password', 'secret', 'api_key']
|
||||
|
||||
def clean_dict_recursive(d):
|
||||
data = {}
|
||||
for k, v in d.items():
|
||||
if not v:
|
||||
pass
|
||||
elif any([sensitivekey in str(k) for sensitivekey in sensitivekeys]):
|
||||
v = "********"
|
||||
elif isinstance(v, dict):
|
||||
v = clean_dict_recursive(v)
|
||||
data[k] = v
|
||||
return data
|
||||
|
||||
data = clean_dict_recursive(data)
|
||||
for sensitivekey in sensitivekeys:
|
||||
for k, v in data.items():
|
||||
if (sensitivekey in k) and v:
|
||||
data[k] = "********"
|
||||
|
||||
logentry.data = json.dumps(data, cls=CustomJSONEncoder, sort_keys=True)
|
||||
elif data:
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
import logging
|
||||
import multiprocessing
|
||||
import os
|
||||
|
||||
from celery import Celery, signals
|
||||
@@ -55,21 +54,6 @@ def on_task_received(sender, request, **kwargs):
|
||||
logger.info(f"Task {request.id} has trace {trace}")
|
||||
|
||||
|
||||
@receiver(signals.after_setup_task_logger)
|
||||
def on_after_setup_task_logger(sender, logger, loglevel, logfile, format, colorize, **kwargs):
|
||||
# This hack seems to be required to get celery to log internal events from eg billiard/pool.py such as
|
||||
# "worker killed because it used too much memory"
|
||||
# You can test that it is working by starting a celery worker with a low value like
|
||||
# --max-memory-per-child 300000
|
||||
# and then trigger a task. Result should look like this:
|
||||
# [2026-09-23 10:42:26,234: WARNING/ForkPoolWorker-16]: [???:???] child process exiting after exceeding memory limit (394540KiB / 300000KiB)
|
||||
# The ???:??? are likely because by copying the handlers, we are also copying the format, but I was unable to find
|
||||
# a better compatible way.
|
||||
multi_logger = multiprocessing.get_logger()
|
||||
multi_logger.setLevel(logging.WARNING)
|
||||
multi_logger.handlers = logger.handlers
|
||||
|
||||
|
||||
@receiver(signals.task_prerun)
|
||||
def on_task_prerun(sender, task_id, task, **kwargs):
|
||||
from pretix.helpers.logs import local
|
||||
|
||||
@@ -109,7 +109,30 @@ let form_handlers = function (el) {
|
||||
}
|
||||
$(this).datetimepicker(opts)
|
||||
})
|
||||
|
||||
el.find("button[data-wait-seconds-enable], input[data-wait-seconds-enable]").each(function(i, input) {
|
||||
var s = parseInt(input.getAttribute("data-wait-seconds-enable")) || 0;
|
||||
var time = $("time", input) || $("time").appendTo(input);
|
||||
// for a11y do not disable input, but do not allow submit
|
||||
function disable_submit(e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
if (s) {
|
||||
input.addEventListener("click", disable_submit);
|
||||
}
|
||||
function wait() {
|
||||
time.attr("datetime", s+"s");
|
||||
if (s > 0) {
|
||||
time.text("(" + s + "s)");
|
||||
window.setTimeout(wait, 1000);
|
||||
s--;
|
||||
} else {
|
||||
time.remove();
|
||||
input.disabled = false;
|
||||
input.removeEventListener("click", disable_submit);
|
||||
}
|
||||
}
|
||||
wait();
|
||||
});
|
||||
el.find('.input-item-count-dec, .input-item-count-inc').on('click', function (e) {
|
||||
e.preventDefault()
|
||||
let step = parseFloat(this.getAttribute('data-step'))
|
||||
|
||||
Reference in New Issue
Block a user