|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
dabo Commit 4296dabo Commit
Revision 4296 Date: 2008-07-19 10:02:07 -0700 (Sat, 19 Jul 2008) Author: Ed Trac: http://svn.dabodev.com/trac/dabo/changeset/4296 Changed: U trunk/ide/ClassDesigner.py U trunk/ide/ClassDesignerEditor.py Log: Took Nate's recent fix and went one step further: the Class Designer will check for syntax errors before you can save code when declaring imports. Also added an errorLog message when a syntax error is found in the _namespaceHacks() method; these can still arise if the developer edits the import declaration code outside of the Class Designer. Diff: Modified: trunk/ide/ClassDesigner.py =================================================================== --- trunk/ide/ClassDesigner.py 2008-07-19 16:21:02 UTC (rev 4295) +++ trunk/ide/ClassDesigner.py 2008-07-19 17:02:07 UTC (rev 4296) @@ -1152,9 +1152,20 @@ dlg = ImportEditDialog(None, BasePrefKey=self.BasePrefKey+".ImportEditDialog") dlg.edtImport.Text = txt - dlg.show() - if dlg.Accepted: - self._classImportDict[frm] = dlg.edtImport.Text + showDialog = True + while showDialog: + dlg.show() + showDialog = dlg.Accepted + if showDialog: + # Check the syntax before storing + txt = dlg.edtImport.Text + try: + compile(txt.strip(), "", "exec") + self._classImportDict[frm] = txt + showDialog = dlg.Accepted = False + except SyntaxError, e: + errMsg = _("Syntax Error: %s") % e + dabo.ui.stop(errMsg, _("Error Compiling Import Declarations")) dlg.release() Modified: trunk/ide/ClassDesignerEditor.py =================================================================== --- trunk/ide/ClassDesignerEditor.py 2008-07-19 16:21:02 UTC (rev 4295) +++ trunk/ide/ClassDesignerEditor.py 2008-07-19 17:02:07 UTC (rev 4296) @@ -64,8 +64,9 @@ if imp: try: exec imp in self._namespaces - except SyntaxError: - pass #Just let namespace import fail. + except SyntaxError, e: + # Record the error so that the developer knows there is a problem. + dabo.errorLog.write(_("Compilation error found in import code: %s") % e) def _getController(self): _______________________________________________ Post Messages to: Dabo-dev@... Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev Searchable Archives: http://leafe.com/archives/search/dabo-dev This message: http://leafe.com/archives/byMID/20080719170207.6B4CC318908@... |
| Free Forum Powered by Nabble | Forum Help |