Skip to content

Commit 6d3bd27

Browse files
authored
Merge pull request #58 from GitRon/feature/improved-required-field-model-whitelist
Removed `SCRUBBER_VALIDATION_WHITELIST` in favour of exiting whitelist
2 parents 001e1b3 + 921e263 commit 6d3bd27

File tree

4 files changed

+5
-20
lines changed

4 files changed

+5
-20
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77
<!--
88
## [Unreleased]
99
10-
-
10+
- Removed `SCRUBBER_VALIDATION_WHITELIST` in favour of `SCRUBBER_REQUIRED_FIELD_MODEL_WHITELIST`
11+
- Added Django test model `db.TestModel` to default whitelist of `SCRUBBER_REQUIRED_FIELD_MODEL_WHITELIST`
1112
-->
1213

1314
## [2.1.1] - 2024-08-20

README.md

+2-8
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,8 @@ activating the strict mode. Defaults to the non-privacy-related Django base mode
311311
Items can either be full model names (e.g. `auth.Group`) or regular expression patterns matching
312312
against the full model name (e.g. `re.compile(auth.*)` to whitelist all auth models).
313313

314-
(default: ['auth.Group', 'auth.Permission', 'contenttypes.ContentType', 'sessions.Session', 'sites.Site',
315-
'django_scrubber.FakeData',))
314+
(default: `('auth.Group', 'auth.Permission', 'contenttypes.ContentType', 'sessions.Session', 'sites.Site',
315+
'django_scrubber.FakeData', 'db.TestModel',)`)
316316

317317
````python
318318
SCRUBBER_MAPPING = {
@@ -322,12 +322,6 @@ SCRUBBER_MAPPING = {
322322

323323
(default: {})
324324

325-
### `SCRUBBER_VALIDATION_WHITELIST`:
326-
327-
Whitelist models you want to exclude from the `scrub_validation` checker command for scrubber-wise undeclared models.
328-
By default, it contains only a test model from Django core which doesn't have to be anonymised.
329-
330-
(default: ['db.TestModel',])
331325

332326
## Logging
333327

django_scrubber/__init__.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@
2525
'auth.Group',
2626
'auth.Permission',
2727
'contenttypes.ContentType',
28+
'db.TestModel',
2829
'sessions.Session',
2930
'sites.Site',
3031
'django_scrubber.FakeData',
3132
],
32-
'SCRUBBER_VALIDATION_WHITELIST': [
33-
'db.TestModel', # Test model from Django core
34-
],
3533
}
3634

3735

django_scrubber/management/commands/scrub_validation.py

-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from django.core.management.base import BaseCommand
44

5-
from django_scrubber import settings_with_fallback
65
from django_scrubber.services.validator import ScrubberValidatorService
76

87

@@ -15,16 +14,9 @@ def handle(self, *args, **options):
1514
found_models = 0
1615
found_fields = 0
1716

18-
whitelisted_models = settings_with_fallback('SCRUBBER_VALIDATION_WHITELIST')
19-
2017
if len(non_scrubbed_field_list):
2118
for model_path, affected_field_list in non_scrubbed_field_list.items():
2219

23-
if model_path in whitelisted_models:
24-
print(f'Model {model_path!r} was excluded via \'SCRUBBER_VALIDATION_WHITELIST\' and will '
25-
'not be validated.')
26-
continue
27-
2820
print(f'Model {model_path!r}:')
2921
found_models += 1
3022
for field in affected_field_list:

0 commit comments

Comments
 (0)