1. Henning Schröder
  2. codeaide

Commits

Henning Schröder  committed e8ca4e0

correctly handle documents without a filename

  • Participants
  • Parent commits fc2ca24
  • Branches default

Comments (0)

Files changed (3)

File .hgignore

View file
  • Ignore whitespace
+.*\.pyc
+.*~

File codeaide/modes/language/__init__.py

View file
  • Ignore whitespace
 
 
     def on_document_changed(self):
-        filename = self.textedit.document().filename
+        try:
+            filename = self.textedit.document().filename
+        except AttributeError, _err:
+            filename = None
         if filename:
             mode = LanguageModeBase.find_by_pattern(filename)
             if mode:

File codeaide/modes/python/main.py

View file
  • Ignore whitespace
         except ImportError:
             return []
         l = []
-        c = Checker(ast, te.document().filename)
+        try:
+            filename = te.document().filename
+        except AttributeError, _err:
+            filename = "__unknown__.py"
+        c = Checker(ast, filename)
         c.messages.sort(lambda a, b: cmp(a.lineno, b.lineno))
         for msg in c.messages:
             args = msg.message_args