split py into modules

This commit is contained in:
relikd
2022-04-05 22:58:53 +02:00
parent 97b40b4886
commit adb26e343e
9 changed files with 705 additions and 688 deletions

11
lektor_groupby/util.py Normal file
View File

@@ -0,0 +1,11 @@
from lektor.reporter import reporter, style
def report_config_error(key: str, field: str, val: str, e: Exception) -> None:
''' Send error message to Lektor reporter. Indicate which field is bad. '''
msg = '[ERROR] invalid config for [{}.{}] = "{}", Error: {}'.format(
key, field, val, repr(e))
try:
reporter._write_line(style(msg, fg='red'))
except Exception:
print(msg) # fallback in case Lektor API changes