MCPcopy Create free account
hub / github.com/internetarchive/openlibrary / save_error

Function save_error

openlibrary/plugins/openlibrary/code.py:1007–1029  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1005
1006
1007def save_error():
1008 t = datetime.datetime.utcnow()
1009 name = "%04d-%02d-%02d/%02d%02d%02d%06d" % (
1010 t.year,
1011 t.month,
1012 t.day,
1013 t.hour,
1014 t.minute,
1015 t.second,
1016 t.microsecond,
1017 )
1018
1019 path = infogami.config.get("errorlog", "errors") + "/" + name + ".html"
1020 dir = os.path.dirname(path)
1021 if not os.path.exists(dir):
1022 os.makedirs(dir)
1023
1024 error = web.safestr(web.djangoerror())
1025 with open(path, "w") as file:
1026 file.write(error)
1027
1028 print("error saved to", path, file=web.debug)
1029 return name
1030
1031
1032def internalerror():

Callers 1

internalerrorFunction · 0.70

Calls 3

getMethod · 0.45
existsMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected