Skip to content

Commit

Permalink
v9.6.5
Browse files Browse the repository at this point in the history
  • Loading branch information
GitRon committed Apr 10, 2024
1 parent 2785705 commit 887ce8a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

**9.6.5** (2024-04-10)
* Added SQLite support for `AbstractScrubbingService`

**9.6.4** (2024-03-28)
* Added convenience feature for `create_translation_file` so the user can omit the `--lang` param if there is only
one language
Expand Down
2 changes: 1 addition & 1 deletion ambient_toolbox/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Python toolbox of Ambient Digital containing an abundance of useful tools and gadgets."""

__version__ = "9.6.4"
__version__ = "9.6.5"
12 changes: 8 additions & 4 deletions ambient_toolbox/services/custom_scrubber.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.contrib.auth.hashers import make_password
from django.contrib.sessions.models import Session
from django.core.management import call_command
from django.db import connections
from django.db import OperationalError, connections


class ScrubbingError(RuntimeError):
Expand Down Expand Up @@ -79,10 +79,14 @@ def process(self):
# Reset scrubber data to avoid huge db dumps
if not self.keep_scrubber_data:
self._logger.info('Clearing data from "django_scrubber_fakedata" ...')
# We truncate and don't scrub because the table is huge and clearing on object-level might take a while.
# Furthermore, can we avoid having a direct dependency to django-scrubber this way.
# We truncate and don't scrub because the table is huge, and clearing on object-level might take a while.
# Furthermore, we can avoid having a direct dependency on django-scrubber this way.
cursor = connections["default"].cursor()
cursor.execute("TRUNCATE TABLE django_scrubber_fakedata;")
try:
cursor.execute("TRUNCATE TABLE django_scrubber_fakedata;")
except OperationalError:
# SQLite doesn't have "TRUNCATE"
cursor.execute("DELETE FROM django_scrubber_fakedata;")

self._logger.info("Scrubbing finished!")

Expand Down

0 comments on commit 887ce8a

Please sign in to comment.