| 26 | abort(exceptions.text_error_template().render()) |
| 27 | |
| 28 | def write(path, content): |
| 29 | RE_PYTHON_ADDR = re.compile(r"<.+? object at 0x[0-9a-fA-F]+>") |
| 30 | directory = os.path.dirname(path) |
| 31 | if not os.path.exists(directory): |
| 32 | os.makedirs(directory, exist_ok=True) |
| 33 | open(path, "wb").write(content.encode("utf-8")) |
| 34 | |
| 35 | python_addr = RE_PYTHON_ADDR.search(content) |
| 36 | if python_addr: |
| 37 | abort('Found "{}" in {} ({})'.format( |
| 38 | python_addr.group(0), os.path.basename(path), path)) |
| 39 | |
| 40 | BASE = os.path.dirname(os.path.realpath(__file__).replace("\\", "/")) |
| 41 | |