Skip to content

Commit 65ad7d8

Browse files
authored
Run account anonymization actions as the patron (internetarchive#11167)
* Run anonymize action as account being anonymized * Log anonymization errors
1 parent 4bd7e57 commit 65ad7d8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

openlibrary/plugins/upstream/account.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
InternetArchiveAccount,
2525
OLAuthenticationError,
2626
OpenLibraryAccount,
27+
RunAs,
2728
audit_accounts,
2829
clear_cookies,
2930
valid_email,
@@ -1194,8 +1195,10 @@ def POST(self):
11941195
raise web.HTTPError("404 Not Found", {"Content-Type": "application/json"})
11951196

11961197
try:
1197-
result = ol_account.anonymize(test=test)
1198-
except Exception:
1198+
with RunAs(ol_account.username):
1199+
result = ol_account.anonymize(test=test)
1200+
except Exception as e:
1201+
logger.error(e)
11991202
raise web.HTTPError(
12001203
"500 Internal Server Error", {"Content-Type": "application/json"}
12011204
)

0 commit comments

Comments
 (0)