(
self,
action: str,
target_type: str,
target_id: Optional[Any],
target_name: str,
timestamp: Optional[datetime],
seed: Optional[str] = None,
)
| 995 | ] |
| 996 | |
| 997 | def _build_admin_activity_id( |
| 998 | self, |
| 999 | action: str, |
| 1000 | target_type: str, |
| 1001 | target_id: Optional[Any], |
| 1002 | target_name: str, |
| 1003 | timestamp: Optional[datetime], |
| 1004 | seed: Optional[str] = None, |
| 1005 | ) -> str: |
| 1006 | timestamp_seed = ( |
| 1007 | str(int(timestamp.timestamp() * 1000)) if timestamp else str(seed or "activity") |
| 1008 | ) |
| 1009 | digest = hashlib.sha1( |
| 1010 | f"{timestamp_seed}:{action}:{target_type}:{target_id}:{target_name}".encode("utf-8") |
| 1011 | ).hexdigest()[:10] |
| 1012 | return f"act_{timestamp_seed}_{digest}" |
| 1013 | |
| 1014 | def _build_file_activity_name(self, file_code: FileCodes) -> str: |
| 1015 | return (file_code.prefix + file_code.suffix) or file_code.code |
no outgoing calls
no test coverage detected