mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
shred_log_fields: Only mark shredded if something happened
This commit is contained in:
@@ -151,16 +151,19 @@ class BaseDataShredder:
|
|||||||
|
|
||||||
def shred_log_fields(logentry, banlist=None, whitelist=None):
|
def shred_log_fields(logentry, banlist=None, whitelist=None):
|
||||||
d = logentry.parsed_data
|
d = logentry.parsed_data
|
||||||
|
shredded = False
|
||||||
if whitelist:
|
if whitelist:
|
||||||
for k, v in d.items():
|
for k, v in d.items():
|
||||||
if k not in whitelist:
|
if k not in whitelist:
|
||||||
d[k] = '█'
|
d[k] = '█'
|
||||||
|
shredded = True
|
||||||
elif banlist:
|
elif banlist:
|
||||||
for f in banlist:
|
for f in banlist:
|
||||||
if f in d:
|
if f in d:
|
||||||
d[f] = '█'
|
d[f] = '█'
|
||||||
|
shredded = True
|
||||||
logentry.data = json.dumps(d)
|
logentry.data = json.dumps(d)
|
||||||
logentry.shredded = True
|
logentry.shredded = logentry.shredded or shredded
|
||||||
logentry.save(update_fields=['data', 'shredded'])
|
logentry.save(update_fields=['data', 'shredded'])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user