Source code for fireblog.settings.validators
import os
[docs]def sitename_validator(item: str):
return 1 <= len(item) <= 100
[docs]def recaptcha_validator(item: str):
'Validates both Recaptcha site key and Recaptcha secret.'
# This is subject to Google changing the len of the recaptcha secret.
return len(item) == 40
[docs]def theme_validator(item: str):
# Get all available themes
theme_folder = os.path.join(os.path.dirname(__file__), '../templates')
themes = next(os.walk(theme_folder))[1]
return item in themes