1095 import builtins |
1095 import builtins |
1096 if not codestring: |
1096 if not codestring: |
1097 try: |
1097 try: |
1098 codestring = readEncodedFile(file)[0] |
1098 codestring = readEncodedFile(file)[0] |
1099 except (UnicodeDecodeError, IOError): |
1099 except (UnicodeDecodeError, IOError): |
1100 return (False, None, None, None, None) |
1100 return (False, None, None, None, None, None) |
1101 |
1101 |
1102 codestring = codestring.replace("\r\n", "\n") |
1102 codestring = codestring.replace("\r\n", "\n") |
1103 codestring = codestring.replace("\r", "\n") |
1103 codestring = codestring.replace("\r", "\n") |
1104 |
1104 |
1105 if codestring and codestring[-1] != '\n': |
1105 if codestring and codestring[-1] != '\n': |
1108 try: |
1108 try: |
1109 if file.endswith('.ptl'): |
1109 if file.endswith('.ptl'): |
1110 try: |
1110 try: |
1111 import quixote.ptl_compile |
1111 import quixote.ptl_compile |
1112 except ImportError: |
1112 except ImportError: |
1113 return (False, None, None, None, None) |
1113 return (False, None, None, None, None, None) |
1114 template = quixote.ptl_compile.Template(codestring, file) |
1114 template = quixote.ptl_compile.Template(codestring, file) |
1115 template.compile() |
1115 template.compile() |
1116 else: |
1116 else: |
1117 builtins.compile(codestring, file, 'exec') |
1117 builtins.compile(codestring, file, 'exec') |
1118 except SyntaxError as detail: |
1118 except SyntaxError as detail: |