05/06 Phase 2: updated and added new files
This commit is contained in:
@@ -98,3 +98,9 @@ def sanitise_string(value: str, max_length: int = None) -> str:
|
||||
def validate_slug(slug: str) -> bool:
|
||||
"""Return True if the slug matches the allowed pattern."""
|
||||
return bool(_SLUG_RE.match(slug))
|
||||
|
||||
|
||||
def validate_setting_key(key: str) -> bool:
|
||||
"""Return True if key is a valid setting key (alphanumeric, underscores, dots)."""
|
||||
import re
|
||||
return bool(key and re.match(r'^[a-zA-Z0-9_.]+$', key) and len(key) <= 100)
|
||||
|
||||
Reference in New Issue
Block a user