v1
This commit is contained in:
23
server/utils.py
Normal file
23
server/utils.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""Common utility helpers for the server package."""
|
||||
from __future__ import annotations
|
||||
|
||||
import uuid
|
||||
from typing import Iterable, List
|
||||
|
||||
|
||||
def normalize_recipients(value: str | None) -> List[str]:
|
||||
"""Split a comma separated string of emails into a clean list."""
|
||||
if not value:
|
||||
return []
|
||||
return [item.strip() for item in value.split(",") if item.strip()]
|
||||
|
||||
|
||||
def is_valid_email(value: str) -> bool:
|
||||
"""Perform a very small sanity check for email addresses."""
|
||||
value = value.strip()
|
||||
return bool(value and "@" in value)
|
||||
|
||||
|
||||
def generate_request_id() -> str:
|
||||
"""Return a UUID4 string for request correlation."""
|
||||
return str(uuid.uuid4())
|
||||
Reference in New Issue
Block a user