()
| 1005 | |
| 1006 | |
| 1007 | def 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 | |
| 1032 | def internalerror(): |
no test coverage detected