dabo Commit
Revision 4848
Date: 2008-12-17 06:09:43 -0800 (Wed, 17 Dec 2008)
Author: Cito
Trac: http://trac.dabodev.com/dabo/changeset/4848

Changed:
U   trunk/dabo/biz/dBizobj.py
U   trunk/dabo/dApp.py
U   trunk/dabo/dColors.py
U   trunk/dabo/dEvents.py
U   trunk/dabo/dLocalize.py
U   trunk/dabo/dObject.py
U   trunk/dabo/dSecurityManager.py
U   trunk/dabo/db/dConnectInfo.py
U   trunk/dabo/db/dConnection.py
U   trunk/dabo/db/dCursorMixin.py
U   trunk/dabo/db/dbSQLite.py
U   trunk/dabo/lib/RemoteConnector.py
U   trunk/dabo/lib/SimpleCrypt.py
U   trunk/dabo/lib/__init__.py
U   trunk/dabo/lib/autosuper/_autosuper.pyx
U   trunk/dabo/lib/autosuper/autosuper.py
U   trunk/dabo/lib/datanav/Form.py
U   trunk/dabo/lib/datanav/PageFrame.py
U   trunk/dabo/lib/eventMixin.py
U   trunk/dabo/lib/manifest.py
U   trunk/dabo/lib/propertyHelperMixin.py
U   trunk/dabo/lib/reportWriter.py
U   trunk/dabo/lib/untabify.py
U   trunk/dabo/ui/__init__.py
U   trunk/dabo/ui/uitk/dCheckBox.py
U   trunk/dabo/ui/uitk/dFormMixin.py
U   trunk/dabo/ui/uitk/dLabel.py
U   trunk/dabo/ui/uitk/dPemMixin.py
U   trunk/dabo/ui/uiwx/__init__.py
U   trunk/dabo/ui/uiwx/dBorderSizer.py
U   trunk/dabo/ui/uiwx/dBorderlessButton.py
U   trunk/dabo/ui/uiwx/dCheckBox.py
U   trunk/dabo/ui/uiwx/dComboBox.py
U   trunk/dabo/ui/uiwx/dControlItemMixin.py
U   trunk/dabo/ui/uiwx/dDialog.py
U   trunk/dabo/ui/uiwx/dEditor.py
U   trunk/dabo/ui/uiwx/dFont.py
U   trunk/dabo/ui/uiwx/dFormMixin.py
U   trunk/dabo/ui/uiwx/dGrid.py
U   trunk/dabo/ui/uiwx/dGridSizer.py
U   trunk/dabo/ui/uiwx/dImage.py
U   trunk/dabo/ui/uiwx/dLabel.py
U   trunk/dabo/ui/uiwx/dLine.py
U   trunk/dabo/ui/uiwx/dLinePlot.py
U   trunk/dabo/ui/uiwx/dListControl.py
U   trunk/dabo/ui/uiwx/dPageFrame.py
U   trunk/dabo/ui/uiwx/dPageFrameMixin.py
U   trunk/dabo/ui/uiwx/dPageFrameNoTabs.py
U   trunk/dabo/ui/uiwx/dPdfWindow.py
U   trunk/dabo/ui/uiwx/dPemMixin.py
U   trunk/dabo/ui/uiwx/dSearchBox.py
U   trunk/dabo/ui/uiwx/dSizer.py
U   trunk/dabo/ui/uiwx/dSizerMixin.py
U   trunk/dabo/ui/uiwx/dSlidePanelControl.py
U   trunk/dabo/ui/uiwx/dSplitter.py
U   trunk/dabo/ui/uiwx/dTextBoxMixin.py
U   trunk/dabo/ui/uiwx/dTreeView.py
U   trunk/ide/ClassDesigner.py
U   trunk/ide/ClassDesignerComponents.py
U   trunk/ide/ClassDesignerControlMixin.py
U   trunk/ide/Editor.py
U   trunk/ide/MenuDesignerForm.py
U   trunk/ide/ReportDesigner.py

Log:
Consistently use new style of raise statement (this is actually not necessary 
but will make transition to Python 3.0 easier).

Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py   2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/biz/dBizobj.py   2008-12-17 14:09:43 UTC (rev 4848)
@@ -848,7 +848,7 @@
                        raise dException.BusinessRuleViolation(errMsg)
                if self.KeyField is None:
                        errMsg = _("No Primary Key defined in the Bizobj for 
%s") % self.DataSource
-                       raise dException.MissingPKException, errMsg
+                       raise dException.MissingPKException(errMsg)
 
                # If this is a dependent (child) bizobj, this will enforce the 
relation
                self.setChildLinkFilter()
@@ -1521,7 +1521,7 @@
                                        if rec[0] == fld][0]
                except IndexError:
                        return None
-                       #raise ValueError, _("Field '%s' does not exist in the 
DataStructure") % fld
+                       #raise ValueError(_("Field '%s' does not exist in the 
DataStructure") % fld)
                return dabo.db.getPythonType(fldInfo)
 
 
@@ -2011,7 +2011,7 @@
                if isinstance(val, dBizobj):
                        self._parent = val
                else:
-                       raise TypeError, _("Parent must descend from dBizobj")
+                       raise TypeError(_("Parent must descend from dBizobj"))
 
 
        def _getParentLinkField(self):
@@ -2321,7 +2321,7 @@
                Must be called before beginning the iteration.
                """
                if not self.__firstpass:
-                       raise RuntimeError, _("Cannot reverse in the middle of 
iteration.")
+                       raise RuntimeError(_("Cannot reverse in the middle of 
iteration."))
                self.__nextfunc = self._prior
                return self
 

Modified: trunk/dabo/dApp.py
===================================================================
--- trunk/dabo/dApp.py  2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/dApp.py  2008-12-17 14:09:43 UTC (rev 4848)
@@ -685,7 +685,7 @@
                                # Not changed or not found; nothing to do
                                if code == 404 and errorOnNotFound:
                                        # Re-raise the error
-                                       raise u2.HTTPError, e
+                                       raise e
                                return
                newFile = resp.read()
                if newFile:
@@ -797,21 +797,19 @@
                        strVal = strVal.__str__()
                if isinstance(strVal, unicode):
                        return strVal
-               ret = None
                try:
                        ret = unicode(strVal, self.Encoding)
                except UnicodeDecodeError, e:
                        # Try some common encodings:
-                       for enc in ("utf-8", "latin-1", "iso-8859-1"):
+                       for enc in ("utf-8", "iso8859-1", "cp1252"):
                                if enc != self.Encoding:
                                        try:
                                                ret = unicode(strVal, enc)
-                                               break
                                        except UnicodeDecodeError:
                                                continue
-               if ret is None:
-                       # All attempts failed
-                       raise UnicodeDecodeError, e
+                                       break
+                       else: # All attempts failed
+                               raise e
                return ret
 
 
@@ -1349,7 +1347,7 @@
                if os.path.exists(val):
                        self._homeDirectory = os.path.abspath(val)
                else:
-                       raise ValueError, _("%s: Path does not exist.") % val
+                       raise ValueError(_("%s: Path does not exist.") % val)
 
 
        def _getIcon(self):
@@ -1452,7 +1450,7 @@
                                warnings.warn(Warning, _("SecurityManager 
previously set"))
                        self._securityManager = value
                else:
-                       raise TypeError, _("SecurityManager must descend from 
dSecurityManager.")
+                       raise TypeError(_("SecurityManager must descend from 
dSecurityManager."))
                        
                        
        def _getShowCommandWindowMenu(self):
@@ -1507,7 +1505,7 @@
                        else:
                                dabo.infoLog.write(_("Tried to set UI to '%s', 
but it failed.") % uiType)
                else:
-                       raise RuntimeError, _("The UI cannot be reset once 
assigned.")
+                       raise RuntimeError(_("The UI cannot be reset once 
assigned."))
 
        
        def _getUserSettingProvider(self):

Modified: trunk/dabo/dColors.py
===================================================================
--- trunk/dabo/dColors.py       2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/dColors.py       2008-12-17 14:09:43 UTC (rev 4848)
@@ -168,7 +168,7 @@
 
 def hexToDec(hx):
        if not isinstance(hx, basestring):
-               raise TypeError, "Input must be a string"
+               raise TypeError("Input must be a string")
        # Define a dict of char-value pairs
        hex = {"0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7, 
"8": 8, 
                        "9": 9, "A": 10, "B": 11, "C": 12, "D": 13, "E": 14, 
"F": 15}
@@ -178,7 +178,7 @@
        pos = 1
        for c in rev:
                if hex.get(c) == None:
-                       raise InvalidCharError, "%s is an invalid hex 
character" % (c, )
+                       raise InvalidCharError("%s is an invalid hex character" 
% (c, ))
                ret += (hex[c] * pos)
                pos = pos * 16
        return ret
@@ -187,12 +187,12 @@
 def tupleToHex(t, includeHash=True):
        """Convert a color tuple into an HTML hex format."""
        if not len(t) == 3:
-               raise LengthError, "Color tuple needs to contain 3 elements"
+               raise LengthError("Color tuple needs to contain 3 elements")
        for rgb in t:
                if not isinstance(rgb, int):
-                       raise IntegerTypeError, "Tuple elements should be all 
integers."
+                       raise IntegerTypeError("Tuple elements should be all 
integers.")
                if not 0 <= rgb <= 255:
-                       raise RgbValueError, "Rgb Value must be in the range 
0-255"
+                       raise RgbValueError("Rgb Value must be in the range 
0-255")
        rx, gx, bx = hex(t[0]), hex(t[1]), hex(t[2])
        # Each is in the format '0x00'.
        r = rx[2:].upper()
@@ -246,9 +246,9 @@
                ret = (int(grps[0]), int(grps[1]), int(grps[2]))
                for val in ret:
                        if not 0 <= val <= 255:
-                               raise KeyError, "Color tuple integer must range 
from 0-255"
+                               raise KeyError("Color tuple integer must range 
from 0-255")
        else:
-               raise KeyError, "Color '%s' is not defined." % color
+               raise KeyError("Color '%s' is not defined." % color)
        return ret
 
 

Modified: trunk/dabo/dEvents.py
===================================================================
--- trunk/dabo/dEvents.py       2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/dEvents.py       2008-12-17 14:09:43 UTC (rev 4848)
@@ -101,8 +101,8 @@
        def __getattr__(self, att):
                if self.EventData.has_key(att):
                        return self._eventData[att]
-               raise AttributeError, "%s.%s object has no attribute %s." % (
-                       self.__class__.__module__, self.__class__.__name__, att)
+               raise AttributeError("%s.%s object has no attribute %s." % (
+                       self.__class__.__module__, self.__class__.__name__, 
att))
 
 
        def _getContinue(self):

Modified: trunk/dabo/dLocalize.py
===================================================================
--- trunk/dabo/dLocalize.py     2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/dLocalize.py     2008-12-17 14:09:43 UTC (rev 4848)
@@ -41,13 +41,13 @@
        """Install the gettext translation service for the passed domain.
 
        Either Dabo will be the only domain, or Dabo will be the fallback for a 
-  different domain that the user's application set up.
+       different domain that the user's application set up.
        """
        global _domains, _defaultLanguage, _defaultEncoding
 
        if localedir is None:
                if domain != "dabo":
-                       raise ValueError, "Must send your application's 
localedir explicitly."
+                       raise ValueError("Must send your application's 
localedir explicitly.")
                localedir = getDaboLocaleDir()
        _domains[domain] = localedir
        #gettext.install(domain, localedir, unicode=unicode_mo)  ## No, don't 
globally bind _
@@ -81,7 +81,7 @@
                try:
                        translation = gettext.translation(domain, localedir, 
languages=lang, codeset=charset)
                except IOError:
-                       raise IOError, "No translation found for domain '%s' 
and language %s." % (domain, lang)
+                       raise IOError("No translation found for domain '%s' and 
language %s." % (domain, lang))
                if daboTranslation:
                        translation.add_fallback(daboTranslation)
 #              translation.install()  ## No, don't globally bind _

Modified: trunk/dabo/dObject.py
===================================================================
--- trunk/dabo/dObject.py       2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/dObject.py       2008-12-17 14:09:43 UTC (rev 4848)
@@ -82,7 +82,7 @@
                if kwargs:
                        # Some kwargs haven't been handled.
                        bad = ", ".join(["'%s'" % kk for kk in kwargs.keys()])
-                       raise TypeError, ("Invalid keyword arguments passed to 
%s: %s") % (self.__repr__(), bad)
+                       raise TypeError("Invalid keyword arguments passed to 
%s: %s" % (self.__repr__(), bad))
 
                if self._call_afterInit:
                        self._afterInit()
@@ -290,7 +290,7 @@
 
        def _setBasePrefKey(self, val):
                if not isinstance(val, types.StringTypes):
-                       raise TypeError, 'BasePrefKey must be a string.'
+                       raise TypeError('BasePrefKey must be a string.')
                self._basePrefKey = val
                pm = self.PreferenceManager
                if pm is not None:
@@ -336,9 +336,9 @@
        
        def _setName(self, val):
                if not isinstance(val, types.StringTypes):
-                       raise TypeError, 'Name must be a string.'
+                       raise TypeError('Name must be a string.')
                if not len(val.split()) == 1:
-                       raise KeyError, 'Name must not contain any spaces'
+                       raise KeyError('Name must not contain any spaces')
                self._name = val
                
                
@@ -371,7 +371,7 @@
 
        def _setPreferenceManager(self, val):
                if not isinstance(val, dPref):
-                       raise TypeError, 'PreferenceManager must be a dPref 
object'
+                       raise TypeError('PreferenceManager must be a dPref 
object')
                self._preferenceManager = val
        
 

Modified: trunk/dabo/dSecurityManager.py
===================================================================
--- trunk/dabo/dSecurityManager.py      2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/dSecurityManager.py      2008-12-17 14:09:43 UTC (rev 4848)
@@ -145,7 +145,7 @@
                if isinstance(value, basestring):
                        self._userCaption = value
                else:
-                       raise TypeError, 'User caption must be string or 
unicode.'
+                       raise TypeError('User caption must be string or 
unicode.')
                        
        
        def _getUserGroups(self):

Modified: trunk/dabo/db/dConnectInfo.py
===================================================================
--- trunk/dabo/db/dConnectInfo.py       2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/db/dConnectInfo.py       2008-12-17 14:09:43 UTC (rev 4848)
@@ -95,7 +95,7 @@
                        if prop:
                                setattr(self, prop, v)
                        else:
-                               raise TypeError, "Property '%s' invalid." % k   
                        
+                               raise TypeError("Property '%s' invalid." % k)
        
        
        def getConnection(self, **kwargs):
@@ -173,7 +173,7 @@
                                        import dbWeb
                                        self._backendObject = dbWeb.Web()
                                else:
-                                       raise ValueError, "Invalid database 
type: %s." % nm
+                                       raise ValueError("Invalid database 
type: %s." % nm)
                        except ImportError:
                                dabo.errorLog.write(_("You do not have the 
database module for %s installed") % dbType)
                                self._dbType = None

Modified: trunk/dabo/db/dConnection.py
===================================================================
--- trunk/dabo/db/dConnection.py        2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/db/dConnection.py        2008-12-17 14:09:43 UTC (rev 4848)
@@ -28,7 +28,7 @@
                        # dConnectInfo class.
                        self._connectInfo = dConnectInfo(connInfo=connectInfo)
                else:
-                       raise TypeError, "dConnectInfo instance or kwargs not 
sent."
+                       raise TypeError("dConnectInfo instance or kwargs not 
sent.")
                self._connection = self._openConnection(**kwargs)
                
                

Modified: trunk/dabo/db/dCursorMixin.py
===================================================================
--- trunk/dabo/db/dCursorMixin.py       2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/db/dCursorMixin.py       2008-12-17 14:09:43 UTC (rev 4848)
@@ -273,7 +273,7 @@
                                                        return ret
                                                        break
                                else:
-                                       raise UnicodeDecodeError, e
+                                       raise e
 #              elif isinstance(field_val, array.array):
 #                      # Usually blob data
 #                      ret = field_val.tostring()
@@ -312,7 +312,7 @@
                        # calling routine will pass the class of the expected 
error, and will
                        # handle it appropriately.
                        if errorClass is not None and isinstance(e, errorClass):
-                               raise errorClass, e
+                               raise e
                        paramStr = ["%s" % p for p in params]
                        dabo.dbActivityLog.write("FAILED SQL: %s, PARAMS: %s" % 
(sql.replace("\n", " "), ", ".join(paramStr)))
                        # Database errors need to be decoded from database 
encoding.
@@ -813,7 +813,7 @@
        def getFieldVal(self, fld, row=None, _rowChangeCallback=None):
                """Return the value of the specified field in the current or 
specified row."""
                if self.RowCount <= 0:
-                       raise dException.NoRecordsException, _("No records in 
the data set.")
+                       raise dException.NoRecordsException(_("No records in 
the data set."))
                if row is None:
                        row = self.RowNumber
 
@@ -888,7 +888,7 @@
        def setFieldVal(self, fld, val, row=None):
                """Set the value of the specified field."""
                if self.RowCount <= 0:
-                       raise dException.NoRecordsException, _("No records in 
the data set")
+                       raise dException.NoRecordsException(_("No records in 
the data set"))
 
                if row is None:
                        row = self.RowNumber

Modified: trunk/dabo/db/dbSQLite.py
===================================================================
--- trunk/dabo/db/dbSQLite.py   2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/db/dbSQLite.py   2008-12-17 14:09:43 UTC (rev 4848)
@@ -56,7 +56,7 @@
                if not forceCreate and not dabo.createDbFiles and (pth != 
":memory:"):
                        if not os.path.exists(pth):
                                # Database file does not exist; raise an error
-                               raise DBFileDoesNotExistException, _("Database 
file '%s' does not exist") % pth
+                               raise DBFileDoesNotExistException(_("Database 
file '%s' does not exist") % pth)
                pth = pth.decode(sys.getfilesystemencoding()).encode("utf-8")
                # Need to specify "isolation_level=None" to have transactions 
working correctly.
                self._connection = self.dbapi.connect(pth, 
factory=DictConnection, isolation_level=None)

Modified: trunk/dabo/lib/RemoteConnector.py
===================================================================
--- trunk/dabo/lib/RemoteConnector.py   2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/lib/RemoteConnector.py   2008-12-17 14:09:43 UTC (rev 4848)
@@ -67,18 +67,17 @@
                pdata, ptyps, pstru = jsonDecode(enc)
                # The values are pickled, so we need to unpickle them first
                def safeLoad(val):
-                       ret = None
                        try:
                                ret = pickle.loads(val)
                        except UnicodeEncodeError, e:
-                               for enctype in (dabo.defaultEncoding, "utf-8", 
"latin-1"):
+                               for enctype in (dabo.defaultEncoding, "utf-8", 
"iso8859-1"):
                                        try:
                                                ret = 
pickle.loads(val.encode(enctype))
-                                               break
                                        except KeyError:
                                                continue
-                       if ret is None:
-                               raise UnicodeEncodeError, e
+                                       break
+                               else:
+                                       raise e
                        return ret
                typs = safeLoad(ptyps)
                data = safeLoad(pdata)

Modified: trunk/dabo/lib/SimpleCrypt.py
===================================================================
--- trunk/dabo/lib/SimpleCrypt.py       2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/lib/SimpleCrypt.py       2008-12-17 14:09:43 UTC (rev 4848)
@@ -52,6 +52,6 @@
                        chunks = [chr(int(aString[i] + aString[i+1], 16)) 
                                        for i in range(0, len(aString), 2)]
                except IndexError:
-                       raise ValueError, _("Incorrectly-encrypted password")
+                       raise ValueError(_("Incorrectly-encrypted password"))
                return "".join(chunks)
 

Modified: trunk/dabo/lib/__init__.py
===================================================================
--- trunk/dabo/lib/__init__.py  2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/lib/__init__.py  2008-12-17 14:09:43 UTC (rev 4848)
@@ -23,8 +23,10 @@
        import simplejson
 except:
        jsonConverter = None
-       def jsonEncode(val): raise ImportError, "The simplejson module is not 
installed"
-       def jsonDecode(val): raise ImportError, "The simplejson module is not 
installed"
+       def jsonEncode(val):
+               raise ImportError("The simplejson module is not installed")
+       def jsonDecode(val):
+               raise ImportError("The simplejson module is not installed")
 else:
        import dejavuJSON
        jsonConverter = dejavuJSON.Converter()

Modified: trunk/dabo/lib/autosuper/_autosuper.pyx
===================================================================
--- trunk/dabo/lib/autosuper/_autosuper.pyx     2008-12-17 11:11:36 UTC (rev 
4847)
+++ trunk/dabo/lib/autosuper/_autosuper.pyx     2008-12-17 14:09:43 UTC (rev 
4848)
@@ -385,7 +385,7 @@
             if cur_class is None:
                 # We could fail to find the class if we're called from a 
function
                 # nested in a method
-                raise TypeError, "Can only call 'super' in a bound method"
+                raise TypeError("Can only call 'super' in a bound method")
 
             if __super_modify_bytecode__:
                 _bind_autosuper(last_method.im_func, cur_class)

Modified: trunk/dabo/lib/autosuper/autosuper.py
===================================================================
--- trunk/dabo/lib/autosuper/autosuper.py       2008-12-17 11:11:36 UTC (rev 
4847)
+++ trunk/dabo/lib/autosuper/autosuper.py       2008-12-17 14:09:43 UTC (rev 
4848)
@@ -449,7 +449,7 @@
         if cur_class is None:
             # We could fail to find the class if we're called from a function
             # nested in a method
-            raise TypeError, "Can only call 'super' in a bound method"
+            raise TypeError("Can only call 'super' in a bound method")
 
         if __super_modify_bytecode__:
             _bind_autosuper(last_method.im_func, cur_class)

Modified: trunk/dabo/lib/datanav/Form.py
===================================================================
--- trunk/dabo/lib/datanav/Form.py      2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/lib/datanav/Form.py      2008-12-17 14:09:43 UTC (rev 4848)
@@ -571,7 +571,7 @@
                elif mode.lower() == "expanded":
                        return self.getAutoReportForm_expanded()
                else:
-                       raise ValueError, "'list' or 'expanded' are the only 
choices."
+                       raise ValueError("'list' or 'expanded' are the only 
choices.")
 
 
        def getAutoReportForm_list(self):
@@ -925,7 +925,7 @@
                elif value == "edit":
                        self._formType = "Edit"
                else:
-                       raise ValueError, "Form type must be 'Normal', 
'PickList', or 'Edit'."
+                       raise ValueError("Form type must be 'Normal', 
'PickList', or 'Edit'.")
                        
 
        def _getPageFrameStyle(self):

Modified: trunk/dabo/lib/datanav/PageFrame.py
===================================================================
--- trunk/dabo/lib/datanav/PageFrame.py 2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/lib/datanav/PageFrame.py 2008-12-17 14:09:43 UTC (rev 4848)
@@ -76,8 +76,8 @@
                }
                pageStyleClass = tabStyles[tabStyle.title()]
        except KeyError:
-               raise KeyError, \
-                               "tabStyle must be one of %s" % tabStyles.keys()
+               raise KeyError(
+                               "tabStyle must be one of %s" % tabStyles.keys())
 
        class DataNavPageFrame(PageFrameMixin, pageStyleClass):
                _pageStyleClass = property(lambda self: pageStyleClass)

Modified: trunk/dabo/lib/eventMixin.py
===================================================================
--- trunk/dabo/lib/eventMixin.py        2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/lib/eventMixin.py        2008-12-17 14:09:43 UTC (rev 4848)
@@ -26,7 +26,7 @@
                        for binding in bindings:
                                self.bindEvent(binding[0], binding[1])
                else:
-                       raise TypeError, "Sequence expected."
+                       raise TypeError("Sequence expected.")
                
 
        def raiseEvent(self, eventClass, uiEvent=None, uiCallAfterFunc=None, 
@@ -54,7 +54,8 @@
 
                # self.__raisedEvents keeps track of a possible problem 
identified by 
                # Vladimir. It is debug code that isn't intended to stick 
around.
-               try: self.__raisedEvents
+               try:
+                       self.__raisedEvents
                except AttributeError:
                        self.__raisedEvents = []
                        
@@ -339,7 +340,7 @@
                if isinstance(val, list):
                        self._eventBindings = val
                else:
-                       raise ValueError, "EventBindings must be a list."
+                       raise ValueError("EventBindings must be a list.")
 
        _EventBindings = property(_getEventBindings, _setEventBindings, None, 
                _("The list of event bindings ([Event, callback]) for this 
object."))           

Modified: trunk/dabo/lib/manifest.py
===================================================================
--- trunk/dabo/lib/manifest.py  2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/lib/manifest.py  2008-12-17 14:09:43 UTC (rev 4848)
@@ -39,7 +39,7 @@
                # Make sure the path exists
                pth = os.path.expanduser(pth)
                if not os.path.exists(pth):
-                       raise OSError, "Path '%s' does not exist." % pth
+                       raise OSError("Path '%s' does not exist." % pth)
 
                # Returned paths are relative to the starting path.
                baseDirName = os.path.split(pth)[-1]

Modified: trunk/dabo/lib/propertyHelperMixin.py
===================================================================
--- trunk/dabo/lib/propertyHelperMixin.py       2008-12-17 11:11:36 UTC (rev 
4847)
+++ trunk/dabo/lib/propertyHelperMixin.py       2008-12-17 14:09:43 UTC (rev 
4848)
@@ -42,7 +42,7 @@
                                                s += """%s '%s'.""" % 
(_("and"), p)
                                        else:
                                                s += """'%s', """ % p
-                               raise ValueError, s
+                               raise ValueError(s)
                return value
 
 
@@ -143,10 +143,10 @@
                                                        propDict[prop] = e
                                        else:
                                                if not ignoreErrors:
-                                                       raise ValueError, 
"Property '%s' is not readable." % prop
+                                                       raise 
ValueError("Property '%s' is not readable." % prop)
                                                pass
                                else:
-                                       raise AttributeError, "'%s' is not a 
property." % prop
+                                       raise AttributeError("'%s' is not a 
property." % prop)
                                        
                if isinstance(propertySequence, (list, tuple)):
                        _fillPropDict(propertySequence)
@@ -199,9 +199,9 @@
                                                        setter(self, 
_propDict[prop])
                                        else:
                                                if not ignoreErrors:
-                                                       raise ValueError, 
"Property '%s' is read-only." % prop
+                                                       raise 
ValueError("Property '%s' is read-only." % prop)
                                else:
-                                       raise AttributeError, "'%s' is not a 
property." % prop
+                                       raise AttributeError("'%s' is not a 
property." % prop)
                        if delayedSettings is not None:
                                for setter, val in delayedSettings.items():
                                        setter(self, val)
@@ -229,7 +229,7 @@
                                        # ignore
                                        continue
                                else:
-                                       raise AttributeError, "'%s' is not a 
property." % prop
+                                       raise AttributeError("'%s' is not a 
property." % prop)
                        try:
                                valToSet = eval(val, context)
                        except (TypeError, SyntaxError, NameError, 
AttributeError):
@@ -333,7 +333,7 @@
 
                        return d
                else:
-                       raise AttributeError, "%s is not a property." % name
+                       raise AttributeError("%s is not a property." % name)
        getPropertyInfo = classmethod(getPropertyInfo)
        
        

Modified: trunk/dabo/lib/reportWriter.py
===================================================================
--- trunk/dabo/lib/reportWriter.py      2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/lib/reportWriter.py      2008-12-17 14:09:43 UTC (rev 4848)
@@ -36,7 +36,7 @@
 
        """ % "\n\t".join(_failedLibs)
 
-       raise ImportError, msg
+       raise ImportError(msg)
 del(_failedLibs)
 #######################################################
 
@@ -131,7 +131,7 @@
                if self.Record.has_key(att):
                        return self.Record.get(att)
 
-               raise AttributeError, "Can't get attribute '%s'." % att
+               raise AttributeError("Can't get attribute '%s'." % att)
 
 
        def initAvailableProps(self):
@@ -189,7 +189,7 @@
                                        val = repr(val)
                                return val
                        else:
-                               raise ValueError, "Property name '%s' 
unrecognized." % prop
+                               raise ValueError("Property name '%s' 
unrecognized." % prop)
 
                if self.has_key(prop):
                        if not evaluate or prop == "type":
@@ -209,7 +209,7 @@
        def setProp(self, prop, val):
                """Update the value of the property."""
                if not self.AvailableProps.has_key(prop):
-                       raise ValueError, "Property '%s' doesn't exist." % prop
+                       raise ValueError("Property '%s' doesn't exist." % prop)
                self[prop] = val
 
 
@@ -1310,7 +1310,7 @@
                """
                _form = self.ReportForm
                if _form is None:
-                       raise ValueError, "ReportForm must be set first."
+                       raise ValueError("ReportForm must be set first.")
 
                _form.reportWriter = self
 
@@ -1935,7 +1935,7 @@
                        if len(s[0]) == 0 or os.path.exists(s[0]):
                                self._outputFile = val
                        else:
-                               raise ValueError, "Path '%s' doesn't exist." % 
s[0]
+                               raise ValueError("Path '%s' doesn't exist." % 
s[0])
 
        def _getPageNumber(self):
                return self._pageNumber
@@ -2009,11 +2009,11 @@
                                self._reportForm = 
self._getFormFromXML(self._reportFormXML)
                                self._setMemento()
                        else:
-                               raise ValueError, "Invalid file type."
+                               raise ValueError("Invalid file type.")
                        self._reportFormFile = val
                        self.HomeDirectory = 
os.path.join(os.path.split(val)[:-1])[0]
                else:
-                       raise ValueError, "Specified file does not exist."
+                       raise ValueError("Specified file does not exist.")
                
 
        def _getReportFormXML(self):

Modified: trunk/dabo/lib/untabify.py
===================================================================
--- trunk/dabo/lib/untabify.py  2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/lib/untabify.py  2008-12-17 14:09:43 UTC (rev 4848)
@@ -12,7 +12,7 @@
        try:
                opts, args = getopt.getopt(sys.argv[1:], "t:")
                if not args:
-                       raise getopt.error, "At least one file argument 
required"
+                       raise getopt.error("At least one file argument 
required")
        except getopt.error, msg:
                print msg
                print "usage:", sys.argv[0], "[-t tabwidth] file ..."

Modified: trunk/dabo/ui/__init__.py
===================================================================
--- trunk/dabo/ui/__init__.py   2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/ui/__init__.py   2008-12-17 14:09:43 UTC (rev 4848)
@@ -51,7 +51,7 @@
        elif uiType.lower() in ("tk", "tkinter", "uitk"):
                typ = "tk"
        else:
-               raise ValueError, "Unknown UI type '%s' passed to loadUI()" % 
uiType
+               raise ValueError("Unknown UI type '%s' passed to loadUI()" % 
uiType)
        
        if currType is None:
                try:

Modified: trunk/dabo/ui/uitk/dCheckBox.py
===================================================================
--- trunk/dabo/ui/uitk/dCheckBox.py     2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/ui/uitk/dCheckBox.py     2008-12-17 14:09:43 UTC (rev 4848)
@@ -70,7 +70,7 @@
 #              elif str(value) == 'Left':
 #                      pass
 #              else:
-#                      raise ValueError, "The only possible values are 'Left' 
and 'Right'."
+#                      raise ValueError("The only possible values are 'Left' 
and 'Right'.")
 # 
 #      # property definitions follow:
 #      Alignment = property(_getAlignment, _setAlignment, None,

Modified: trunk/dabo/ui/uitk/dFormMixin.py
===================================================================
--- trunk/dabo/ui/uitk/dFormMixin.py    2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/ui/uitk/dFormMixin.py    2008-12-17 14:09:43 UTC (rev 4848)
@@ -274,7 +274,7 @@
 #              elif value == 'FullScreen':
 #                      self.ShowFullScreen()
 #              else:
-#                      raise ValueError, ("The only possible values are "
+#                      raise ValueError("The only possible values are "
 #                                                      "'Normal', 'Minimized', 
'Maximized', and 'FullScreen'")
 # 
 #      # property definitions follow:

Modified: trunk/dabo/ui/uitk/dLabel.py
===================================================================
--- trunk/dabo/ui/uitk/dLabel.py        2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/ui/uitk/dLabel.py        2008-12-17 14:09:43 UTC (rev 4848)
@@ -61,7 +61,7 @@
 #              elif value == 'Right':
 #                      self._addWindowStyleFlag(wx.ALIGN_RIGHT)
 #              else:
-#                      raise ValueError, ("The only possible values are "
+#                      raise ValueError("The only possible values are "
 #                                                      "'Left', 'Center', and 
'Right'.")
 # 
 #      # property definitions follow:

Modified: trunk/dabo/ui/uitk/dPemMixin.py
===================================================================
--- trunk/dabo/ui/uitk/dPemMixin.py     2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/ui/uitk/dPemMixin.py     2008-12-17 14:09:43 UTC (rev 4848)
@@ -70,8 +70,8 @@
                                exit
                                
                if not ret:
-                       raise AttributeError, "%s object has no attribute %s" % 
(
-                               self._name, att)
+                       raise AttributeError("%s object has no attribute %s" % (
+                               self._name, att))
                else:
                        return ret
 
@@ -524,7 +524,7 @@
                elif style == 'Default':
                        pass
                else:
-                       raise ValueError, ("The only possible values are 
'None', "
+                       raise ValueError("The only possible values are 'None', "
                                                        "'Simple', 'Sunken', 
and 'Raised.'")
 
 

Modified: trunk/dabo/ui/uiwx/__init__.py
===================================================================
--- trunk/dabo/ui/uiwx/__init__.py      2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/ui/uiwx/__init__.py      2008-12-17 14:09:43 UTC (rev 4848)
@@ -1102,7 +1102,7 @@
                                app.urlFetch(codefile)
        # At this point the file should be present and updated. If not...
        if not os.path.exists(srcFile):
-               raise IOError, _("The file '%s' cannot be found") % srcFile
+               raise IOError(_("The file '%s' cannot be found") % srcFile)
        return srcFile
 
 
@@ -1222,7 +1222,7 @@
                        *Must Override*
                        """
                        if not self._controlClass:
-                               raise TypeError, _("Cannot create custom editor 
without a control class specified.")
+                               raise TypeError(_("Cannot create custom editor 
without a control class specified."))
                        self._control = self._controlClass(parent)
                        self.SetControl(self._control)
                        if evtHandler:
@@ -1347,7 +1347,7 @@
                        except AttributeError:
                                cap = "Browse"
                else:
-                       raise TypeError, "Incorrect data source passed to 
browse()"
+                       raise TypeError("Incorrect data source passed to 
browse()")
        else:
                dataSet = dataSource
                cap = "Browse"
@@ -1438,7 +1438,7 @@
                try:
                        txt = wind.Caption
                except AttributeError:
-                       raise ValueError, "No text supplied to fontMetric call"
+                       raise ValueError("No text supplied to fontMetric call")
        fnt = wind.GetFont()
        if face is not None:
                fnt.SetFaceName(face)

Modified: trunk/dabo/ui/uiwx/dBorderSizer.py
===================================================================
--- trunk/dabo/ui/uiwx/dBorderSizer.py  2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/ui/uiwx/dBorderSizer.py  2008-12-17 14:09:43 UTC (rev 4848)
@@ -49,7 +49,7 @@
                if kwargs:
                        # Some kwargs haven't been handled.
                        bad = ", ".join(kwargs.keys())
-                       raise TypeError, ("Invalid keyword arguments passed to 
dBorderSizer: %s") % kwargs
+                       raise TypeError(("Invalid keyword arguments passed to 
dBorderSizer: %s") % kwargs)
                
                # Mark the box as part of the sizer
                self.Box._belongsToBorderSizer = True

Modified: trunk/dabo/ui/uiwx/dBorderlessButton.py
===================================================================
--- trunk/dabo/ui/uiwx/dBorderlessButton.py     2008-12-17 11:11:36 UTC (rev 
4847)
+++ trunk/dabo/ui/uiwx/dBorderlessButton.py     2008-12-17 14:09:43 UTC (rev 
4848)
@@ -4,7 +4,7 @@
 try:
        import wx.lib.platebtn as platebtn
 except ImportError:
-       raise ImportError, "Your version of wxPython is too old for 
dBorderlessButton"
+       raise ImportError("Your version of wxPython is too old for 
dBorderlessButton")
 import dabo
 import dabo.ui
 
@@ -70,7 +70,7 @@
                                self._backColoHover = val
                                self.SetPressColor(wx.Color(*val))
                        else:
-                               raise ValueError, "BackColorHover must be a 
valid color string or tuple"
+                               raise ValueError("BackColorHover must be a 
valid color string or tuple")
                else:
                        self._properties["BackColorHover"] = val
 

Modified: trunk/dabo/ui/uiwx/dCheckBox.py
===================================================================
--- trunk/dabo/ui/uiwx/dCheckBox.py     2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/ui/uiwx/dCheckBox.py     2008-12-17 14:09:43 UTC (rev 4848)
@@ -59,7 +59,7 @@
                elif val.lower()[0] == "l":
                        pass
                else:
-                       raise ValueError, _("The only possible values are 
'Left' and 'Right'.")
+                       raise ValueError(_("The only possible values are 'Left' 
and 'Right'."))
                
 
        def _getThreeState(self):

Modified: trunk/dabo/ui/uiwx/dComboBox.py
===================================================================
--- trunk/dabo/ui/uiwx/dComboBox.py     2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/ui/uiwx/dComboBox.py     2008-12-17 14:09:43 UTC (rev 4848)
@@ -180,7 +180,7 @@
                        else:
                                val = int(val)
                                if val < 1:
-                                       raise ValueError, 'TextLength must be a 
positve Integer'
+                                       raise ValueError('TextLength must be a 
positve Integer')
                                self._textLength = val
                        self._checkTextLength()
                        

Modified: trunk/dabo/ui/uiwx/dControlItemMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dControlItemMixin.py     2008-12-17 11:11:36 UTC (rev 
4847)
+++ trunk/dabo/ui/uiwx/dControlItemMixin.py     2008-12-17 14:09:43 UTC (rev 
4848)
@@ -162,7 +162,7 @@
                        self._keys = val
                        self._invertedKeys = None
                else:
-                       raise TypeError, _("Keys must be a dictionary or 
list/tuple.")
+                       raise TypeError(_("Keys must be a dictionary or 
list/tuple."))
                        
 
        def _getKeyValue(self):
@@ -236,7 +236,7 @@
                                invalidSelections = []
 
                        if invalidSelections:
-                               raise ValueError, _("Trying to set %s.Value to 
these invalid selections: %s") % (self.Name, invalidSelections)
+                               raise ValueError(_("Trying to set %s.Value to 
these invalid selections: %s") % (self.Name, invalidSelections))
 
                        self._afterValueChanged()
                else:
@@ -303,7 +303,7 @@
                                        # Force a re-ordering
                                        self.sort()
                        else:
-                               raise TypeError, _("SortFunction must be 
callable")
+                               raise TypeError(_("SortFunction must be 
callable"))
                else:
                        self._properties["SortFunction"] = val
 
@@ -353,11 +353,11 @@
                                if isinstance(string, basestring):
                                        index = self.FindString(string)
                                        if index < 0:
-                                               raise ValueError, _("String 
must be present in the choices.")
+                                               raise ValueError(_("String must 
be present in the choices."))
                                        else:
                                                self.setSelection(index)
                                else:
-                                       raise TypeError, _("Unicode or string 
required.")
+                                       raise TypeError(_("Unicode or string 
required."))
                        self._afterValueChanged()
                else:
                        self._properties["StringValue"] = value

Modified: trunk/dabo/ui/uiwx/dDialog.py
===================================================================
--- trunk/dabo/ui/uiwx/dDialog.py       2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/ui/uiwx/dDialog.py       2008-12-17 14:09:43 UTC (rev 4848)
@@ -148,7 +148,7 @@
 
        def _setBorderless(self, val):
                if self._constructed():
-                       raise ValueError, _("Cannot set the Borderless property 
once the dialog is created.")
+                       raise ValueError(_("Cannot set the Borderless property 
once the dialog is created."))
                else:
                        self._properties["Borderless"] = val
 
@@ -233,7 +233,7 @@
                self._help = self._extractKey((properties, kwargs), "Help")
                # Check for both OK and Yes. This simply does not work, at 
least with wxPython.
                if self._ok and self._yes:
-                       raise ValueError, _("Dialogs cannot have both 'OK' and 
'Yes' buttons.")
+                       raise ValueError(_("Dialogs cannot have both 'OK' and 
'Yes' buttons."))
                self._cancelOnEscape = True
                super(dStandardButtonDialog, self).__init__(parent=parent, 
properties=properties, *args, **kwargs)
                self._baseClass = dStandardButtonDialog

Modified: trunk/dabo/ui/uiwx/dEditor.py
===================================================================
--- trunk/dabo/ui/uiwx/dEditor.py       2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/ui/uiwx/dEditor.py       2008-12-17 14:09:43 UTC (rev 4848)
@@ -590,7 +590,7 @@
                                                "t": seltxt.title}[newcase]
                                self.ReplaceSelection(fnc())
                        except KeyError:
-                               raise ValueError, _("Case must be either upper, 
lower, capitalize, or invert.")
+                               raise ValueError(_("Case must be either upper, 
lower, capitalize, or invert."))
                self.SelectionPosition = pos
 
        
@@ -1949,7 +1949,7 @@
                        self._bookmarkBackColor = val
                        self._setBookmarkMarker()
                else:
-                       raise ValueError, "BookmarkBackColor must be a valid 
color string or tuple"
+                       raise ValueError("BookmarkBackColor must be a valid 
color string or tuple")
 
 
        def _getBookmarkForeColor(self):
@@ -1962,7 +1962,7 @@
                        self._bookmarkForeColor = val
                        self._setBookmarkMarker()
                else:
-                       raise ValueError, "BookmarkForeColor must be a valid 
color string or tuple"
+                       raise ValueError("BookmarkForeColor must be a valid 
color string or tuple")
 
 
 
@@ -1974,7 +1974,7 @@
                        self._bookmarkIcon = val
                        self._setBookmarkMarker()
                else:
-                       raise ValueError, "Value of BookmarkIcon must be in %s" 
% (bmkIconDic.keys(),)
+                       raise ValueError("Value of BookmarkIcon must be in %s" 
% (bmkIconDic.keys(),))
 
 
        def _getBufferedDrawing(self):
@@ -2062,7 +2062,7 @@
                                self.ConvertEOLs(stc.STC_EOL_CR)
                                self._eolMode = "CR"
                        else:
-                               raise ValueError, "EOLMode value must be either 
'CRLF', 'LF', or 'CR'"
+                               raise ValueError("EOLMode value must be either 
'CRLF', 'LF', or 'CR'")
                else:
                        self._properties["EOLMode"] = val
 

Modified: trunk/dabo/ui/uiwx/dFont.py
===================================================================
--- trunk/dabo/ui/uiwx/dFont.py 2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/ui/uiwx/dFont.py 2008-12-17 14:09:43 UTC (rev 4848)
@@ -84,7 +84,7 @@
                                                break
 
                        if not automatic_face:
-                               raise dabo.dException.FontNotFoundException, 
_("The font '%s' doesn't exist on this system.") % val
+                               raise 
dabo.dException.FontNotFoundException(_("The font '%s' doesn't exist on this 
system.") % val)
  
                self._propsChanged()
 

Modified: trunk/dabo/ui/uiwx/dFormMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dFormMixin.py    2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/ui/uiwx/dFormMixin.py    2008-12-17 14:09:43 UTC (rev 4848)
@@ -563,7 +563,7 @@
                        id = obj.RegID
                        if self._objectRegistry.has_key(id):
                                if not isinstance(self._objectRegistry[id], 
dabo.ui.deadObject):
-                                       raise KeyError, _("Duplicate RegID '%s' 
found") % id
+                                       raise KeyError(_("Duplicate RegID '%s' 
found") % id)
                                else:
                                        del self.__dict__[id]
                        self._objectRegistry[id] = obj
@@ -1059,7 +1059,7 @@
                        elif lowvalue == "fullscreen":
                                self.ShowFullScreen()
                        else:
-                               raise ValueError, ("The only possible values 
are "
+                               raise ValueError("The only possible values are "
                                                                "'Normal', 
'Minimized', 'Maximized', and 'FullScreen'")
                else:
                        self._properties["WindowState"] = value

Modified: trunk/dabo/ui/uiwx/dGrid.py
===================================================================
--- trunk/dabo/ui/uiwx/dGrid.py 2008-12-17 11:11:36 UTC (rev 4847)
+++ trunk/dabo/ui/uiwx/dGrid.py 2008-12-17 14:09:43 UTC (rev 4848)
@@ -2978,7 +2978,7 @@
                                if issubclass(col, dabo.ui.dColumn):
                                        col = col(self, *args, **kwargs)
                                else:
-                                       raise ValueError,

 (27117 bytes were truncated as it was too long for the email (max 40000 bytes.)


_______________________________________________
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