dabo Commit
Revision 6262
Date: 2010-12-18 13:21:48 -0800 (Sat, 18 Dec 2010)
Author: Jacekk
Trac: http://trac.dabodev.com/changeset/6262

Changed:
U   trunk/dabo/db/dCursorMixin.py

Log:
Added some verbosity to the class exceptions.

Diff:
Modified: trunk/dabo/db/dCursorMixin.py
===================================================================
--- trunk/dabo/db/dCursorMixin.py       2010-12-18 00:32:49 UTC (rev 6261)
+++ trunk/dabo/db/dCursorMixin.py       2010-12-18 21:21:48 UTC (rev 6262)
@@ -834,7 +834,7 @@
                """
                if self.RowCount <= 0:
                        raise dException.NoRecordsException(
-                                       _("No records in the data set."))
+                                       _("No records in dataset '%s'.") % 
self.Table)
                ret = None
                if row is None:
                        row = self.RowNumber
@@ -855,7 +855,8 @@
        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 dataset '%s'.") % 
self.Table)
                if row is None:
                        row = self.RowNumber
                try:
@@ -943,7 +944,8 @@
        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 dataset '%s'.") % 
self.Table)
                if row is None:
                        row = self.RowNumber
 
@@ -1197,7 +1199,8 @@
        def cloneRecord(self):
                """Creates a copy of the current record and adds it to the 
dataset."""
                if not self.RowCount:
-                       raise dException.NoRecordsException(_("No records in 
the data set."))
+                       raise dException.NoRecordsException(
+                                       _("No records in dataset '%s'.") % 
self.Table)
                rec = self._records[self.RowNumber].copy()
                if self.AutoPopulatePK:
                        kf = self.KeyField
@@ -1283,7 +1286,8 @@
                if self.RowCount > 0:
                        self.RowNumber = 0
                else:
-                       raise dException.NoRecordsException(_("No records in 
data set"))
+                       raise dException.NoRecordsException(
+                                       _("No records in dataset '%s'.") % 
self.Table)
 
 
        def prior(self):
@@ -1296,7 +1300,7 @@
                                                _("Already at the beginning of 
the data set."))
                else:
                        raise dException.NoRecordsException(
-                                       _("No records in data set"))
+                                       _("No records in dataset '%s'.") % 
self.Table)
 
 
        def next(self):
@@ -1308,7 +1312,8 @@
                                raise dException.EndOfFileException(
                                                _("Already at the end of the 
data set."))
                else:
-                       raise dException.NoRecordsException(_("No records in 
data set"))
+                       raise dException.NoRecordsException(
+                                       _("No records in dataset '%s'.") % 
self.Table)
 
 
        def last(self):
@@ -1316,7 +1321,8 @@
                if self.RowCount > 0:
                        self.RowNumber = self.RowCount-1
                else:
-                       raise dException.NoRecordsException(_("No records in 
data set"))
+                       raise dException.NoRecordsException(
+                                       _("No records in dataset '%s'.") % 
self.Table)
 
 
        def save(self, allRows=False, includeNewUnchanged=False):
@@ -1836,8 +1842,8 @@
                and an exception is raised.
                """
                if (rownum >= self.RowCount) or (rownum < 0):
-                       rc = self.RowCount
-                       raise dException.dException(_("Invalid row specified: 
%(rownum)s. RowCount=%(rc)s") % locals())
+                       raise dException.dException(
+                                       _("Invalid row specified: %s. 
RowCount=%s Table='%s'") % (rownum, self.RowCount, self.Table))
                self.RowNumber = rownum
 
 



_______________________________________________
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