summaryrefslogtreecommitdiff
path: root/ishtar_common/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r--ishtar_common/utils.py35
1 files changed, 31 insertions, 4 deletions
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py
index 35289145c..0a6926d9d 100644
--- a/ishtar_common/utils.py
+++ b/ishtar_common/utils.py
@@ -508,8 +508,6 @@ class OwnPerms:
return q
-
-
def update_data(data, new_data, merge=False):
"""
Update a data directory taking account of key detail
@@ -620,11 +618,11 @@ class MultiValueDict(BaseMultiValueDict):
return lst
-def is_downloadable(url):
+def is_downloadable(curl):
"""
Does the url contain a downloadable resource
"""
- h = requests.head(url, allow_redirects=True)
+ h = requests.head(curl, allow_redirects=True)
header = h.headers
content_type = header.get("content-type")
if "text" in content_type.lower():
@@ -736,6 +734,35 @@ def deserialize_args_for_tasks(sender, kwargs, extra_kwargs=None):
return sender, instance
+def get_person_gdpr_log(view_name, request, data_type, queryset, slice_query=None):
+ if not settings.GDPR_LOGGING:
+ return
+ if view_name == "get_item":
+ activity = "DE" if data_type == "csv" else "DC"
+ elif view_name == "show_item":
+ activity = "PV" if not data_type else "PE"
+ elif view_name in ("new_qa_item", "new_item"):
+ activity = "PC"
+ elif view_name in ("modify_qa_item", "modify_item"):
+ activity = "PM"
+ elif view_name == "delete_item":
+ activity = "PD"
+ elif view_name == "merge_person":
+ activity = "Pm"
+ elif view_name == "admin_person_consultation":
+ activity = "AC"
+ elif view_name == "admin_person_view":
+ activity = "AV"
+ elif view_name == "admin_person_modify":
+ activity = "AM"
+ elif view_name == "admin_person_delete":
+ activity = "AD"
+ else:
+ return
+ GDPRLog = apps.get_model("ishtar_common", "GDPRLog")
+ GDPRLog.create_log(request, activity, queryset, slice_query)
+
+
EXTRA_KWARGS_TRIGGER = [
"_cascade_change",
"_cached_labels_bulk_update",