Skip to content

Commit

Permalink
Add account data to legal backup
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanw committed Jul 18, 2024
1 parent 42ffa1c commit 476a1b3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions fragdenstaat_de/theme/legal_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import requests

from froide.account.export import export_user_data
from froide.foirequest.pdf_generator import FoiRequestPDFGenerator

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -44,6 +45,17 @@ def make_legal_backup_for_user(user):
)
response.raise_for_status()

# Add basic account info
filename, filebytes = next(export_user_data(user))
assert filename == "account.json"
file_handle = io.BytesIO(filebytes)
r = requests.put(
f"{folder_url}/{quote_plus(filename)}",
data=file_handle,
auth=(webdav_username, webdav_password),
)
r.raise_for_status()

foirequests = user.foirequest_set.all()
for foirequest in foirequests:
pdf_generator = FoiRequestPDFGenerator(foirequest)
Expand Down

0 comments on commit 476a1b3

Please sign in to comment.