diff roundup/backends/back_anydbm.py @ 3925:603ec9630b08

i18n for hyperdb and backend errors I got all of the hyperdb exceptions. There were some ValueErrors in some of the backends that I left untouched. I wasn't sure how to regenerate the roundup.pot file so that still needs to be done I think this takes care of [SF#1069258]
author Justus Pendleton <jpend@users.sourceforge.net>
date Thu, 27 Sep 2007 06:18:53 +0000
parents 666b70676ec6
children de6326aee6d0
line wrap: on
line diff
--- a/roundup/backends/back_anydbm.py	Thu Sep 27 06:12:57 2007 +0000
+++ b/roundup/backends/back_anydbm.py	Thu Sep 27 06:18:53 2007 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 #
-#$Id: back_anydbm.py,v 1.207 2007-09-16 06:51:48 jpend Exp $
+#$Id: back_anydbm.py,v 1.208 2007-09-27 06:18:53 jpend Exp $
 '''This module defines a backend that saves the hyperdatabase in a
 database chosen by anydbm. It is guaranteed to always be available in python
 versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several
@@ -215,7 +215,8 @@
         if os.path.exists(path):
             db_type = whichdb.whichdb(path)
             if not db_type:
-                raise hyperdb.DatabaseError, "Couldn't identify database type"
+                raise hyperdb.DatabaseError, \
+                    _("Couldn't identify database type")
         elif os.path.exists(path+'.db'):
             # if the path ends in '.db', it's a dbm database, whether
             # anydbm says it's dbhash or not!
@@ -241,8 +242,8 @@
             dbm = __import__(db_type)
         except ImportError:
             raise hyperdb.DatabaseError, \
-                "Couldn't open database - the required module '%s'"\
-                " is not available"%db_type
+                _("Couldn't open database - the required module '%s'"\
+                " is not available")%db_type
         if __debug__:
             logging.getLogger('hyperdb').debug("opendb %r.open(%r, %r)"%(db_type, path,
                 mode))
@@ -791,7 +792,7 @@
             raise KeyError, '"id" is reserved'
 
         if self.db.journaltag is None:
-            raise hyperdb.DatabaseError, 'Database open read-only'
+            raise hyperdb.DatabaseError, _('Database open read-only')
 
         if propvalues.has_key('creation') or propvalues.has_key('activity'):
             raise KeyError, '"creation" and "activity" are reserved'
@@ -1066,7 +1067,7 @@
             raise KeyError, '"id" is reserved'
 
         if self.db.journaltag is None:
-            raise hyperdb.DatabaseError, 'Database open read-only'
+            raise hyperdb.DatabaseError, _('Database open read-only')
 
         node = self.db.getnode(self.classname, nodeid)
         if node.has_key(self.db.RETIRED_FLAG):
@@ -1263,7 +1264,7 @@
         to modify the "creation" or "activity" properties cause a KeyError.
         '''
         if self.db.journaltag is None:
-            raise hyperdb.DatabaseError, 'Database open read-only'
+            raise hyperdb.DatabaseError, _('Database open read-only')
 
         self.fireAuditors('retire', nodeid, None)
 
@@ -1281,7 +1282,7 @@
         Make node available for all operations like it was before retirement.
         '''
         if self.db.journaltag is None:
-            raise hyperdb.DatabaseError, 'Database open read-only'
+            raise hyperdb.DatabaseError, _('Database open read-only')
 
         node = self.db.getnode(self.classname, nodeid)
         # check if key property was overrided
@@ -1327,7 +1328,7 @@
         support the session storage of the cgi interface.
         '''
         if self.db.journaltag is None:
-            raise hyperdb.DatabaseError, 'Database open read-only'
+            raise hyperdb.DatabaseError, _('Database open read-only')
         self.db.destroynode(self.classname, nodeid)
 
     def history(self, nodeid):
@@ -1897,7 +1898,7 @@
             Return the nodeid of the node imported.
         '''
         if self.db.journaltag is None:
-            raise hyperdb.DatabaseError, 'Database open read-only'
+            raise hyperdb.DatabaseError, _('Database open read-only')
         properties = self.getprops()
 
         # make the new node's property map

Roundup Issue Tracker: http://roundup-tracker.org/