dabo Commit
Revision 5670
Date: 2010-02-09 09:41:55 -0800 (Tue, 09 Feb 2010)
Author: Paul
Trac: http://trac.dabodev.com/changeset/5670

Changed:
U   trunk/ide/wizards/AppWizard/AppWizard.py

Log:
Refactored some unneeded exec() calls out of AppWizard. Worked around an error
that would happen when selecting a saved profile.


Diff:
Modified: trunk/ide/wizards/AppWizard/AppWizard.py
===================================================================
--- trunk/ide/wizards/AppWizard/AppWizard.py    2010-02-09 01:53:10 UTC (rev 
5669)
+++ trunk/ide/wizards/AppWizard/AppWizard.py    2010-02-09 17:41:55 UTC (rev 
5670)
@@ -252,14 +252,23 @@
                else:
                        showFields = self.serverFields
                for fld in self.fieldNames:
+                       ctl = getattr(self, "ctl%s" % fld)
                        if fld in showFields:
                                val = dbdefs[fld]
-                               exec("self.ctl%s.Value = r'%s' " % (fld, val) )
-                               exec("self.ctl%s.Visible = True " % fld )
+                               try:
+                                       ctl.Value = val
+                               except ValueError, e:
+                                       if "string must be present in the 
choices" in str(e).lower():
+                                               # Not sure why the saved 
profile dbType is empty. No time to 
+                                               # find out why now, but at 
least the AW won't crash anymore.
+                                               pass
+                                       else:
+                                               raise
+                               ctl.Visible = True
                        else:
                                # Not a field used for this db type
-                               exec("self.ctl%s.Value = None" % fld )
-                               exec("self.ctl%s.Visible = False " % fld )
+                               ctl.Value = None
+                               ctl.Visible = False
                # Enable the file search button if this is a file-based backend
                if embedded:
                        self.szDB.showItem(self.btnSrch)



_______________________________________________
Post Messages to: [email protected]
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/[email protected]

Reply via email to