commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

r5220 - in trunk/gnue-appserver/src: . classrep language


From: johannes
Subject: r5220 - in trunk/gnue-appserver/src: . classrep language
Date: Thu, 4 Mar 2004 12:39:19 -0600 (CST)

Author: johannes
Date: 2004-03-04 12:39:17 -0600 (Thu, 04 Mar 2004)
New Revision: 5220

Modified:
   trunk/gnue-appserver/src/classrep/Base.py
   trunk/gnue-appserver/src/classrep/Definition.py
   trunk/gnue-appserver/src/classrep/Namespace.py
   trunk/gnue-appserver/src/classrep/dtest.py
   trunk/gnue-appserver/src/classrep/mtest.py
   trunk/gnue-appserver/src/classrep/test.py
   trunk/gnue-appserver/src/geasBClass.py
   trunk/gnue-appserver/src/geasConfiguration.py
   trunk/gnue-appserver/src/geasGsdGen.py
   trunk/gnue-appserver/src/geasInstance.py
   trunk/gnue-appserver/src/geasRpcServer.py
   trunk/gnue-appserver/src/geasSession.py
   trunk/gnue-appserver/src/geasSessionManager.py
   trunk/gnue-appserver/src/language/Exceptions.py
   trunk/gnue-appserver/src/language/test.py
   trunk/gnue-appserver/src/test.py
   trunk/gnue-appserver/src/testRPC.py
Log:
Marked strings for translations.


Modified: trunk/gnue-appserver/src/classrep/Base.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Base.py   2004-03-04 18:24:54 UTC (rev 
5219)
+++ trunk/gnue-appserver/src/classrep/Base.py   2004-03-04 18:39:17 UTC (rev 
5220)
@@ -86,14 +86,15 @@
   # Get a condition to fetch a single item for the dictionary
   # ---------------------------------------------------------------------------
   def _getSingleCondition (self, key):
-    return EClassRepository ("%s: _getSingleCondition() not implemented!" %
+    return EClassRepository (_("%s: _getSingleCondition() not implemented!") %
                              self.table)
 
   # ---------------------------------------------------------------------------
   # Use _getNewItem in derived classes to instanciate new dictionary-items
   # ---------------------------------------------------------------------------
   def _getNewItem (self, obj):
-    raise EClassRepository ("%s: _getNewItem() not implemented!" % self.table)
+    raise EClassRepository (_("%s: _getNewItem() not implemented!") % \
+                            self.table)
 
   # ---------------------------------------------------------------------------
   # Return all keys 

Modified: trunk/gnue-appserver/src/classrep/Definition.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Definition.py     2004-03-04 18:24:54 UTC 
(rev 5219)
+++ trunk/gnue-appserver/src/classrep/Definition.py     2004-03-04 18:39:17 UTC 
(rev 5220)
@@ -40,7 +40,7 @@
   def __init__ (self, filename):
     self.filename = filename
     if not os.path.isfile (filename):
-      raise Exception, "Can't find %s" % filename
+      raise Exception, _("Cannot find file '%s'") % filename
 
     self.parser   = ConfigParser.ConfigParser ()
     self.parser.read (self.filename)
@@ -74,22 +74,22 @@
        self._properties [identifier] = data
 
       else:
-       raise EInvalidDefinition ("Invalid identifier %s." % identifier)
+       raise EInvalidDefinition (_("Invalid identifier '%s'.") % identifier)
 
     # Make some basic integrity checks
     for klass in self._classes.keys ():
       (module, classname) = splitName (klass)
       if not self._modules.has_key (module):
-       raise EInvalidDefinition ("Module %s not found." % module)
+       raise EInvalidDefinition (_("Module '%s' not found.") % module)
 
     for prop in self._properties.keys ():
       (klass, property) = string.split (prop, '.')
       if not self._classes.has_key (klass):
-       raise EInvalidDefinition ("Class %s not found." % klass)
+       raise EInvalidDefinition (_("Class '%s' not found.") % klass)
 
       (module, item) = splitName (property)
       if not self._modules.has_key (module):
-       raise EInvalidDefinition ("Module %s not found." % module)
+       raise EInvalidDefinition (_("Module '%s' not found.") % module)
 
   # ---------------------------------------------------------------------------
   # return a list of modules defined in the configuration file
@@ -137,23 +137,23 @@
 
   x = RepositoryDefinition ('repository.ini')
 
-  print "\nModules:"
+  print _("\nModules:")
   for m in x.modules ():
     print m
 
 
-  print "\nClasses:"
+  print _("\nClasses:")
   for c in x.classes ():
     print c
 
-  print "\nProperties:"
+  print _("\nProperties:")
   for p in x.properties ():
     print p
 
   print "\n\n"
 
   for p in x.properties ('gnue_module'):
-    print "gnue_module::", p
+    print _("gnue_module::"), p
 
 
   print "----"

Modified: trunk/gnue-appserver/src/classrep/Namespace.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Namespace.py      2004-03-04 18:24:54 UTC 
(rev 5219)
+++ trunk/gnue-appserver/src/classrep/Namespace.py      2004-03-04 18:39:17 UTC 
(rev 5220)
@@ -39,7 +39,7 @@
 # =============================================================================
 class EInvalidName (EClassRepository):
   def __init__ (self, name):
-    msg = "'%s' is not a valid, fully qualified identifier." % name
+    msg = _("'%s' is not a valid, fully qualified identifier.") % name
     EClassRepository.__init__ (self, msg)
 
 
@@ -48,7 +48,7 @@
 # =============================================================================
 class EBadReference (EClassRepository):
   def __init__ (self, item, reference):
-    msg = "Reference %s of object %s is invalid." % (reference, item)
+    msg = _("Reference %s of object %s is invalid.") % (reference, item)
     EClassRepository.__init__ (self, msg)
 
 # =============================================================================
@@ -56,7 +56,7 @@
 # =============================================================================
 class EModuleNotFound (EClassRepository):
   def __init__ (self, module):
-    msg = "Module '%s' not found in class repository." % module
+    msg = _("Module '%s' not found in class repository.") % module
     EClassRepository.__init__ (self, msg)
 
 # =============================================================================
@@ -64,7 +64,7 @@
 # =============================================================================
 class EClassNotFound (EClassRepository):
   def __init__ (self, klass):
-    msg = "Class '%s' not found in class repository." % klass
+    msg = _("Class '%s' not found in class repository.") % klass
     EClassRepository.__init__ (self, msg)
 
 # =============================================================================
@@ -72,7 +72,7 @@
 # =============================================================================
 class EPropertyNotFound (EClassRepository):
   def __init__ (self, classname, property):
-    msg = "Class '%s' has no property '%s'." % (classname, property)
+    msg = _("Class '%s' has no property '%s'.") % (classname, property)
     EClassRepository.__init__ (self, msg)
 
 # =============================================================================
@@ -80,7 +80,7 @@
 # =============================================================================
 class EProcedureNotFound (EClassRepository):
   def __init__ (self, classname, procedure):
-    msg = "Class '%s' has no procedure '%s'." % (classname, procedure)
+    msg = _("Class '%s' has no procedure '%s'.") % (classname, procedure)
     EClassRepository.__init__ (self, msg)
 
 # =============================================================================
@@ -88,7 +88,7 @@
 # =============================================================================
 class EInvalidDefinition (EClassRepository):
   def __init__ (self, text):
-    msg = "Invalid repository definition: %s" % text
+    msg = _("Invalid repository definition: %s") % text
     EClassRepository.__init__ (self, msg)
 
 # =============================================================================

Modified: trunk/gnue-appserver/src/classrep/dtest.py
===================================================================
--- trunk/gnue-appserver/src/classrep/dtest.py  2004-03-04 18:24:54 UTC (rev 
5219)
+++ trunk/gnue-appserver/src/classrep/dtest.py  2004-03-04 18:39:17 UTC (rev 
5220)
@@ -31,56 +31,56 @@
   app = testApp ()
   sm = app.getSessionManager ()
 
-  print "Requesting class 'gnue_property'\n"
+  print _("Requesting class 'gnue_property'\n")
   klass = sm.classes ["gnue_property"]
 
   print "\n"
 
-  print "Requesting class 'address_person'\n"
+  print _("Requesting class 'address_person'\n")
 
 # -------------
   klass = sm.classes ["address_person"]
 
-  print "Name = %s, Comment = %s, Fullname = %s\n" % (klass.gnue_name, 
+  print _("Name = %s, Comment = %s, Fullname = %s\n") % (klass.gnue_name, 
                     klass.gnue_comment, klass.fullName)
-  print "Number of properties in class: %d" % len (klass.properties)
-  print "Properties:"
+  print _("Number of properties in class: %d") % len (klass.properties)
+  print _("Properties:")
 
 
   for p in klass.properties.keys ():
     pObj = klass.properties [p]
-    print "Property %s: %s (%s)" % (pObj.gnue_name, pObj.gnue_type, 
+    print _("Property %s: %s (%s)") % (pObj.gnue_name, pObj.gnue_type, 
         pObj.gnue_comment)
-  print "End of properties"
+  print _("End of properties")
 
   klass = sm.classes ["gnue_module"]
-  print "Number of properties in %s: %d" % (klass.fullName, 
+  print _("Number of properties in %s: %d") % (klass.fullName, 
                       len (klass.properties))
 
 # print sm.Classes.keys ()
 
 # -----------------
 
-  print "Now it should come faster (cached):\n"
+  print _("Now it should come faster (cached):\n")
 
   klass = sm.classes ["address_person"]
 
-  print "Name = %s, Comment = %s, Fullname = %s\n" % (klass.gnue_name, 
+  print _("Name = %s, Comment = %s, Fullname = %s\n") % (klass.gnue_name, 
                     klass.gnue_comment, klass.fullName)
-  print "Number of properties in class: %d" % len (klass.properties)
+  print _("Number of properties in class: %d") % len (klass.properties)
 
 
   for p in klass.properties.keys ():
     pObj = klass.properties [p]
-    print "Property %s: %s (%s)" % (pObj.gnue_name, pObj.gnue_type, 
+    print _("Property %s: %s (%s)") % (pObj.gnue_name, pObj.gnue_type, 
          pObj.gnue_comment)
 
 # ---- gnue_*
 
-  print "Fetching gnue_class :)"
+  print _("Fetching gnue_class :)")
   gclass = sm.classes ["gnue_class"]
-  print "Name = %s (full:%s) Comment = %s" % (gclass.gnue_name, 
gclass.fullName,
-                   gclass.gnue_comment)
+  print _("Name = %s (full:%s) Comment = %s") % \
+         (gclass.gnue_name, gclass.fullName, gclass.gnue_comment)
 
-  print "Number of properties: %d" % len (gclass.properties)
+  print _("Number of properties: %d") % len (gclass.properties)
 

Modified: trunk/gnue-appserver/src/classrep/mtest.py
===================================================================
--- trunk/gnue-appserver/src/classrep/mtest.py  2004-03-04 18:24:54 UTC (rev 
5219)
+++ trunk/gnue-appserver/src/classrep/mtest.py  2004-03-04 18:39:17 UTC (rev 
5220)
@@ -31,24 +31,24 @@
 # Dump some values of a class definition
 # -----------------------------------------------------------------------------
 def dumpClass (aName):
-  print "\nRequesting class '%s' ..." % aName
+  print _("\nRequesting class '%s' ...") % aName
   aClass = sm.classes [aName]
 
-  print "Fullname:", aClass.fullName
-  print "Id      :", aClass.gnue_id
-  print "Module  :", aClass.module.fullName
-  print "Comment :", aClass.gnue_comment
+  print _("Fullname: %s") % aClass.fullName
+  print _("Id      : %s") % aClass.gnue_id
+  print _("Module  : %s") % aClass.module.fullName
+  print _("Comment : %s") % aClass.gnue_comment
 
-  print "\nProperties:"
+  print _("\nProperties:")
 
   for prop in aClass.properties.values ():
-    print "Fullname:", prop.fullName
-    print "Comment :", prop.gnue_comment
-    print "Module  :", prop.gnue_module
-    print "Type    :", prop.gnue_type
+    print _("Fullname: %s") % prop.fullName
+    print _("Comment : %s") % prop.gnue_comment
+    print _("Module  : %s") % prop.gnue_module
+    print _("Type    : %s") % prop.gnue_type
     print 
 
-  print "End of dump for '%s'\n" % aName
+  print _("End of dump for '%s'\n") % aName
 
 if __name__ == '__main__':
   # First we have to create a session from the language interface
@@ -59,9 +59,9 @@
   dumpClass ('address_person')
   dumpClass ('gnue_class')
 
-  print "Searching for property 'gnue_name' in class 'gnue_property' ..."
+  print _("Searching for property 'gnue_name' in class 'gnue_property' ...")
   x = sm.classes ['gnue_property']
   y = x.findProp ('gnue_name')
-  print "Fullname:", y.fullName
-  print "Module  :", y.gnue_module
-  print "Type    :", y.gnue_type
+  print _("Fullname: %s") % y.fullName
+  print _("Module  : %s") % y.gnue_module
+  print _("Type    : %s") % y.gnue_type

Modified: trunk/gnue-appserver/src/classrep/test.py
===================================================================
--- trunk/gnue-appserver/src/classrep/test.py   2004-03-04 18:24:54 UTC (rev 
5219)
+++ trunk/gnue-appserver/src/classrep/test.py   2004-03-04 18:39:17 UTC (rev 
5220)
@@ -28,18 +28,18 @@
   app = testApp ()
   sm  = app.getSessionManager ()
 
-  print "Already loaded modules:", sm.modules.keys ()
-  print "Already loaded classes:", sm.classes.keys ()
+  print _("Already loaded modules:"), sm.modules.keys ()
+  print _("Already loaded classes:"), sm.classes.keys ()
 
-  print "Modules:", sm.modules.values ()
+  print _("Modules:"), sm.modules.values ()
 
-  print '\nModule "address":'
+  print _('\nModule "address":')
   m = sm.modules ["address"]
   m._session.setcontext ('address')
   # m = sm.modules ["gnue"]
   print "%s: %s\n" % (m.gnue_name, m.gnue_comment)
 
-  print "Classes in 'address':"
+  print _("Classes in 'address':")
   for k in m.classes.keys ():
     print k
     cl = m.classes [k]
@@ -47,28 +47,28 @@
       print cl.fullName + "." + p
     print "-" * 50
 
-  print "Procedures of 'address_person':"
+  print _("Procedures of 'address_person':")
   ap = m.classes ['address_person']
   for pr in ap.procedures.values ():
-    print "%s coded in %s" % (pr.fullName, pr.gnue_language)
+    print _("%s coded in %s") % (pr.fullName, pr.gnue_language)
 
-  print "Number of modules: %d\n" % len (sm.modules)
+  print _("Number of modules: %d\n") % len (sm.modules)
 
-  print "All modules via keys ():"
+  print _("All modules via keys ():")
   for k in sm.modules.keys ():
     m = sm.modules [k]
     print k, ":", m.gnue_comment
 
   print
-  print "All modules via values ():"
+  print _("All modules via values ():")
   for m in sm.modules.values ():
     print m.gnue_name + ": " + m.gnue_comment
 
   print
-  print "All modules via items ():"
+  print _("All modules via items ():")
   for i in sm.modules.items ():
     print i
 
   print
-  print 'Is there a module "address": %d' % sm.modules.has_key ("address")
-  print 'Is there a module "foo": %d' % sm.modules.has_key ("foo")
+  print _('Is there a module "address": %d') % sm.modules.has_key ("address")
+  print _('Is there a module "foo": %d') % sm.modules.has_key ("foo")

Modified: trunk/gnue-appserver/src/geasBClass.py
===================================================================
--- trunk/gnue-appserver/src/geasBClass.py      2004-03-04 18:24:54 UTC (rev 
5219)
+++ trunk/gnue-appserver/src/geasBClass.py      2004-03-04 18:39:17 UTC (rev 
5220)
@@ -19,7 +19,7 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place 
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# $Id: geasBClass.py,v 1.5 2003/02/17 07:31:06 jcater Exp $
+# $Id$
 
 from gnue.common.datasources import GDataSource,GConditions
 import geasInstance
@@ -121,7 +121,7 @@
         # store record here
         pass
       else:        
-        print "'%s' is no valid obj id" % i
+        print _("'%s' is no valid obj id") % i
   
   def call(self,obj_id_list,methodname,parameters):
     pass
@@ -133,4 +133,4 @@
         # store record here
         pass
       else:        
-        print "'%s' is no valid obj id" % i
+        print _("'%s' is no valid obj id") % i

Modified: trunk/gnue-appserver/src/geasConfiguration.py
===================================================================
--- trunk/gnue-appserver/src/geasConfiguration.py       2004-03-04 18:24:54 UTC 
(rev 5219)
+++ trunk/gnue-appserver/src/geasConfiguration.py       2004-03-04 18:39:17 UTC 
(rev 5220)
@@ -19,7 +19,7 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# $Id: geasConfiguration.py,v 1.4 2003/09/01 18:01:45 reinhard Exp $
+# $Id$
 
 from gnue.common.formatting import GTypecast
 
@@ -28,38 +28,38 @@
 
   { 'Name'       : 'database',
     'Type'       : 'Setting',
-    'Comment'    : 'Name of the database connection appserver is using',
-    'Description': 'Name of the database connection appserver is using',
+    'Comment'    : _('Name of the database connection appserver is using'),
+    'Description': _('Name of the database connection appserver is using'),
     'Typecast'   : GTypecast.text,
     'Default'    : 'gnue' },
 
   { 'Name'       : 'rpctype',
     'Type'       : 'Setting',
-    'Comment'    : 'RPC Interface Type appserver is providing',
-    'Description': 'RPC Interface Type appserver is providing',
+    'Comment'    : _('RPC Interface Type appserver is providing'),
+    'Description': _('RPC Interface Type appserver is providing'),
     'Typecast'   : GTypecast.text,
     'Default'    : 'xmlrpc' },
 
   { 'Name'       : 'rpcport',
     'Type'       : 'Setting',
-    'Comment'    : 'Port (if needed) for RPC Interface',
-    'Description': 'Port (if needed) for RPC Interface',
+    'Comment'    : _('Port (if needed) for RPC Interface'),
+    'Description': _('Port (if needed) for RPC Interface'),
     'Typecast'   : GTypecast.whole,
     'Default'    : '8765' },
 
   { 'Name'       : 'allowed_hosts',
     'Type'       : 'Setting',
-    'Comment'    : 'Hosts which are allowed to access appserver.',
-    'Description': 'Hosts which are allowed to access appserver.',
+    'Comment'    : _('Hosts which are allowed to access appserver.'),
+    'Description': _('Hosts which are allowed to access appserver.'),
     'Typecast'   : GTypecast.text,
     'Default'    : '' },
 
   { 'Name'       : 'httpdir',
     'Type'       : 'Setting',
-    'Comment'    : 'Directory, where files which appserver should serve per'+\
-                   ' http are stored',
-    'Description': 'Directory, where files which appserver should serve per'+\
-                   ' http are stored',
+    'Comment'    : _('Directory, where files which appserver should serve 
per'+\
+                   ' http are stored'),
+    'Description': _('Directory, where files which appserver should serve 
per'+\
+                     ' http are stored'),
     'Typecast'   : GTypecast.text,
     'Default'    : "/this_dir_shouldn't exist." }, # default should be 
overridden
 )

Modified: trunk/gnue-appserver/src/geasGsdGen.py
===================================================================
--- trunk/gnue-appserver/src/geasGsdGen.py      2004-03-04 18:24:54 UTC (rev 
5219)
+++ trunk/gnue-appserver/src/geasGsdGen.py      2004-03-04 18:39:17 UTC (rev 
5220)
@@ -36,9 +36,9 @@
   NAME    = "geasGsdGen"
   VERSION = "0.0.1"
   COMMAND = "gnue-gsdgen"
-  SUMMARY = _("A tool to create GNUe Schema Definition (gsd) files from ") + \
-            _("the appservers class repository.")
-  USAGE   = "%s %s" % (GClientApp.USAGE, _(" [classname] [classname] [...]"))
+  SUMMARY = _("A tool to create GNUe Schema Definition (gsd) files from " + \
+              "the appservers class repository.")
+  USAGE   = "%s %s" % (GClientApp.USAGE, " [classname] [classname] [...]")
   COMMAND_OPTIONS = [
     ['output', 'o', 'output-file', True, None, "file",
       _('Name of the resulting gsd-file')],
@@ -77,7 +77,7 @@
       sSupport.writeSchemaToFile (self.__filename, self.ARGUMENTS, self.__type)
 
     except Exception, msg:
-      sys.stderr.write (_("Error: %s\n" % msg))
+      sys.stderr.write (_("Error: %s\n") % msg)
       sys.exit (1)
 
 

Modified: trunk/gnue-appserver/src/geasInstance.py
===================================================================
--- trunk/gnue-appserver/src/geasInstance.py    2004-03-04 18:24:54 UTC (rev 
5219)
+++ trunk/gnue-appserver/src/geasInstance.py    2004-03-04 18:39:17 UTC (rev 
5220)
@@ -29,6 +29,24 @@
 from gnue.appserver.language import Object, Session
 
 # =============================================================================
+# Exceptions
+# =============================================================================
+
+class EInvalidDBValue (Exception):
+  def __init__ (self, value, propertyName):
+    self._text = _("Database returned invalid value '%s' for property '%s'") % 
\
+                   (repr (value), propertyName)
+    Exception.__init__ (self, self._text)
+
+
+class EInvalidValue (Exception):
+  def __init__ (self, value, propertyName):
+    self._text = _("Invalid value '%s' for property '%s'") % \
+                  (repr (value), propertyName)
+    Exception.__init__ (self, self._text)
+
+
+# =============================================================================
 # Instance class
 # =============================================================================
 
@@ -65,8 +83,7 @@
         # if not UnicodeType then return normal string
         return value
       else:
-        raise Exception, ("Database returned invalid value '%s' for " + \
-                          "property '%s'") % (repr (value), propertyname)
+        raise EInvalidDBValue (value, propertyname)
     
 
     # Number property
@@ -79,8 +96,7 @@
           # ... with fractional part
           return float (value)
       except ValueError:
-        raise Exception, ("Database returned invalid value '%s' for " + \
-                            "property '%s'") % (repr (value), propertyname)
+        raise EInvalidDBValue (value, propertyname)
       
     # Date property
     elif propertydef.gnue_type == "date":
@@ -93,8 +109,7 @@
         # TODO: Check if valid date
         return value
       else:
-        raise Exception, ("Database returned invalid value '%s' for " + \
-                          "property '%s'") % (repr (value), propertyname)
+        raise EInvalidDBValue (value, propertyname)
 
     # Time property
     elif propertydef.gnue_type == "time":
@@ -110,8 +125,7 @@
         # TODO: Check if valid time
         return value
       else:
-        raise Exception, ("Database returned invalid value '%s' for " + \
-                          "property '%s'") % (repr (value), propertyname)
+        raise EInvalidDBValue (value, propertyname)
 
     # Date/Time property
     elif propertydef.gnue_type == "datetime":
@@ -124,8 +138,7 @@
         # TODO: Check if valid datetime
         return value
       else:
-        raise Exception, ("Database returned invalid value '%s' for " + \
-                          "property '%s'") % (repr (value), propertyname)
+        raise EInvalidDBValue (value, propertyname)
 
     # Boolean property
     elif propertydef.gnue_type == "boolean":
@@ -134,8 +147,7 @@
       elif value in [1, "1", "t", "T", "true", "true", "y", "Y", "yes", "YES"]:
         return 1
       else:
-        raise Exception, ("Database returned invalid value '%s' for " + \
-                          "property '%s'") % (repr (value), propertyname)
+        raise EInvalidDBValue (value, propertyname)
 
     # Reference property: gnue_type is a classname
     elif self.__classdef.classes.has_key (propertydef.gnue_type):
@@ -146,15 +158,15 @@
         # if not UnicodeType then return normal string
         return value
       else:
-        raise Exception, ("Database returned invalid value '%s' for " + \
-                          "property '%s'") % (repr (value), propertyname)
+        raise EInvalidDBValue (value, propertyname)
 
     # TODO: Missing property types:
     #       * list properties
     #       * calculated properties (must have triggers working first)
 
     else:
-      raise Exception, "Property type '%s' not defined" % propertydef.gnue_type
+      raise Exception (_("Property type '%s' not defined") % \
+                        propertydef.gnue_type)
 
   # ---------------------------------------------------------------------------
   # Get the values of a list of properties
@@ -197,8 +209,7 @@
           # ... with fractional part
           value = float (value)
       except ValueError:
-        raise Exception, "Invalid value '%s' for property '%s'" % \
-                         (value, propertyname)
+        raise EInvalidValue (value, propertyname)
 
     # Date property
     elif propertydef.gnue_type == "date":
@@ -207,8 +218,7 @@
         # value for date properties. So silently accept that.
         value = mx.DateTime.ISO.ParseDateTime (value)
       except ValueError:
-        raise Exception, "Invalid value '%s' for property '%s'" % \
-                         (value, propertyname)
+        raise EInvalidValue (value, propertyname)
 
     # Time property
     elif propertydef.gnue_type == "time":
@@ -217,16 +227,14 @@
         # value for time properties. So silently accept that.
         value = mx.DateTime.ISO.ParseDateTime (value)
       except ValueError:
-        raise Exception, "Invalid value '%s' for property '%s'" % \
-                         (value, propertyname)
+        raise EInvalidValue (value, propertyname)
 
     # Date/Time property
     elif propertydef.gnue_type == "datetime":
       try:
         value = mx.DateTime.ISO.ParseDateTime (value)
       except ValueError:
-        raise Exception, "Invalid value '%s' for property '%s'" % \
-                         (value, propertyname)
+        raise EInvalidValue (value, propertyname)
 
     # Boolean property
     elif propertydef.gnue_type == "boolean":
@@ -235,8 +243,7 @@
       elif value in [1, "1", "t", "T", "true", "true", "y", "Y", "yes", "YES"]:
         value = 1
       else:
-        raise Exception, "Invalid value '%s' for property '%s'" % \
-                         (value, propertyname)
+        raise EInvalidValue (value, propertyname)
 
     self.__record.putField (propertydef.column, value)
 
@@ -306,7 +313,7 @@
       method = cx.buildMethod(proceduredef.gnue_name, proceduredef.gnue_code)
       retcode = method(params)
     except Exception, msg:
-      print "Error occured during method invokation: %s" % msg
+      print _("Error occured during method invokation: %s") % msg
       retcode = -1
 
     # Save changes made by the procedure

Modified: trunk/gnue-appserver/src/geasRpcServer.py
===================================================================
--- trunk/gnue-appserver/src/geasRpcServer.py   2004-03-04 18:24:54 UTC (rev 
5219)
+++ trunk/gnue-appserver/src/geasRpcServer.py   2004-03-04 18:39:17 UTC (rev 
5220)
@@ -19,7 +19,7 @@
 #
 # Copyright 2001-2004 Free Software Foundation
 #
-# $Id: geasRpcServer.py,v 1.29 2003/10/15 14:03:37 siesel Exp $
+# $Id$
 
 from gnue.appserver import VERSION
 from gnue.appserver import geasSessionManager
@@ -42,34 +42,34 @@
   VERSION = VERSION
   USAGE = GServerApp.USAGE
   COMMAND = 'gnue-appserver'
-  SUMMARY = "GNUe Application Server is a data and business rules server. " \
-          + "It provides a backend to forms and reports. In an n-tier " \
-          + "environment, it holds all business rules/logic and provides " \
-          + "data access to various database backends."
+  SUMMARY = _("GNUe Application Server is a data and business rules server. " \
+            + "It provides a backend to forms and reports. In an n-tier " \
+            + "environment, it holds all business rules/logic and provides " \
+            + "data access to various database backends.")
 
   COMMAND_OPTIONS = [
     [ 'rpctype',None,'rpc-type',1,None, 'type',
-      _('Set the GNURPC connection type. The currently supported values ')+
-      _("for <type> are 'xmlrpc','xmlrpc.py_xmlrpc', 'xmlrpc.pw_xmlrpc'")+
-      _("and 'pyro'. For more information on GNURPC connection types have ")+
-      _('a look at common/doc/RPC-abstraction. ')],
+      _('Set the GNURPC connection type. The currently supported values '+
+        "for <type> are 'xmlrpc','xmlrpc.py_xmlrpc', 'xmlrpc.pw_xmlrpc'"+
+        "and 'pyro'. For more information on GNURPC connection types have "+
+        'a look at common/doc/RPC-abstraction. ')],
     [ 'rpcport',None,'rpc-port',1,None, 'port',
-      _('Set the GNURPC port. For more information on ')+
-      _('GNURPC have a look at common/doc/RPC-abstraction. ')],
+      _('Set the GNURPC port. For more information on ' +
+        'GNURPC have a look at common/doc/RPC-abstraction. ')],
     [ 'database',None,'database',1,None, 'name',
-      _('Set the Database to use for loading and storing data to ')+
-      _("<name>. Appserver will search for it in ")+
-      _('connections.conf. ')],
+      _('Set the Database to use for loading and storing data to '+
+        "<name>. Appserver will search for it in "+
+        'connections.conf. ')],
     [ 'username',"u",'username',1,None, 'user',
       _('Set the username for the used database.')],
     [ 'password',"p",'password',1,None, 'password',
       _('Set the password for the used database.')],
     [ 'selftest',None,'selftest',0,None, None,
-      _('Test appservers connection to the backend database, check ')+
-      _('correctness of global settings, etc..')],
+      _('Test appservers connection to the backend database, check '+
+        'correctness of global settings, etc..')],
     [ 'web-frontend',None,'web-frontend',0,None, None,
-      _('Enable appservers web frontend. Just works for the rpc-type XMLRPC. 
')+
-      _('The webfrontend is at the same port as XMLRPC. ')]]
+      _('Enable appservers web frontend. Just works for the rpc-type XMLRPC. '+
+        'The webfrontend is at the same port as XMLRPC. ')]]
 
 #  USE_DATABASE_OPTIONS = 1 # Conflicts with the existing username and password
 
@@ -110,7 +110,7 @@
 
     if rpctype in ('xmlrpc','xmlrpc.pw_xmlrpc','xmlrpc.py_xmlrpc'):
       port = gConfig ("rpcport")
-      print "Exporting our services via %s (port %s) ..." % (rpctype,port)
+      print _("Exporting our services via %s (port %s) ...") % (rpctype,port)
       params = {'port': int (port),
                 'allowed_hosts': gConfig ('allowed_hosts')}
 
@@ -122,17 +122,17 @@
       self.setTransports({rpctype: params})
 
     elif rpctype == "pyro":
-      print "Exporting our services via Pyro (EXPERIMENTAL!) ..."
+      print _("Exporting our services via Pyro (EXPERIMENTAL!) ...")
       self.setTransports ({'pyro':{}})
 
     elif rpctype == "sockets":
       # Sockets not working yet
-      print "Exporting our services via sockets (EXPERIMENTAL!) ..."
+      print _("Exporting our services via sockets (EXPERIMENTAL!) ...")
       self.setTransports ({'sockets':{}})
 
     else:
       # wrong transport protocol set. exiting
-      print "The protocol you've set is currently not supported."
+      print _("The protocol you've set is currently not supported.")
       sys.exit (-1)
 
   # ---------------------------------------------------------------------------
@@ -141,7 +141,7 @@
 
   def htmlStatus (self):
     out = "<HTML><HEAD></HEAD><BODY>"
-    out += "Status: %s Sessions opened</BODY></HTML>" % self.sm._sessNo
+    out += _("Status: %s Sessions opened") % self.sm._sessNo 
     out += "</BODY></HTML>"
     return out
 
@@ -174,7 +174,7 @@
       while 1 == 1:
         time.sleep (1999999)
     except KeyboardInterrupt:
-      print "Appserver is shutting down....ok"
+      print _("Appserver is shutting down....ok")
 
   # ---------------------------------------------------------------------------
   # Request a session manager (called once for every connection)
@@ -207,8 +207,8 @@
     print _("Step 1: Startup Session Manager\n")
     sm = self.requestSessionManager ()
 
-    print _("Step 2: Logging into the session (as user 'hacker'")+\
-          _("with password 'secret')...\n")
+    print _("Step 2: Logging into the session (as user 'hacker'"+\
+            "with password 'secret')...\n")
     session=sm.open ({'user':"hacker", 'password':"secret"})
 
     print _("\nStep 3: Creating and populating list object ...\n")

Modified: trunk/gnue-appserver/src/geasSession.py
===================================================================
--- trunk/gnue-appserver/src/geasSession.py     2004-03-04 18:24:54 UTC (rev 
5219)
+++ trunk/gnue-appserver/src/geasSession.py     2004-03-04 18:39:17 UTC (rev 
5220)
@@ -61,7 +61,7 @@
 
     # check if user has access rights for this class
     if not self.__authAdapter.hasAccess (self, self.__user, classname):
-      raise Exception, "Access to class '%s' denied" % classname
+      raise Exception, _("Access to class '%s' denied") % classname
 
     return self.sm.classes [classname]
 
@@ -147,7 +147,7 @@
     if self.__lists.has_key (list_id):
       return self.__lists [list_id]
     else:
-      raise Exception, "Can't find a list with ID '%s'" % list_id
+      raise Exception, _("Can't find a list with ID '%s'") % list_id
 
   # ---------------------------------------------------------------------------
   # Count the number of objects in the list

Modified: trunk/gnue-appserver/src/geasSessionManager.py
===================================================================
--- trunk/gnue-appserver/src/geasSessionManager.py      2004-03-04 18:24:54 UTC 
(rev 5219)
+++ trunk/gnue-appserver/src/geasSessionManager.py      2004-03-04 18:39:17 UTC 
(rev 5220)
@@ -73,7 +73,7 @@
     if self._sessions.has_key (sess_id):
       return self._sessions [sess_id]
     else:
-      raise Exception, "Can't find a session with ID '%s'" % sess_id
+      raise Exception, _("Can't find a session with ID '%s'") % sess_id
 
   # ---------------------------------------------------------------------------
   # official API functions

Modified: trunk/gnue-appserver/src/language/Exceptions.py
===================================================================
--- trunk/gnue-appserver/src/language/Exceptions.py     2004-03-04 18:24:54 UTC 
(rev 5219)
+++ trunk/gnue-appserver/src/language/Exceptions.py     2004-03-04 18:39:17 UTC 
(rev 5220)
@@ -49,7 +49,7 @@
 class ENoContext (EQualificationError):
 
   def __init__ (self, name):
-    msg = "Cannot qualifiy name '%s', no context specified." % name
+    msg = _("Cannot qualifiy name '%s', no context specified.") % name
     EQualificationError.__init__ (self, msg)
 
 # ---------------------------------------------------------------------------
@@ -57,5 +57,5 @@
 # ---------------------------------------------------------------------------
 class EMemberNotFound (ELanguageInterface):
   def __init__ (self, aClass, aMember):
-    ELanguageInterface.__init__ (self, "Class '%s' has no member '%s'" % 
+    ELanguageInterface.__init__ (self, _("Class '%s' has no member '%s'") % 
                                  (aClass, aMember))

Modified: trunk/gnue-appserver/src/language/test.py
===================================================================
--- trunk/gnue-appserver/src/language/test.py   2004-03-04 18:24:54 UTC (rev 
5219)
+++ trunk/gnue-appserver/src/language/test.py   2004-03-04 18:39:17 UTC (rev 
5220)
@@ -27,25 +27,27 @@
 if __name__ == "__main__":
   app = App.App ()
 
-  print "requesting new session ..."
+  print _("requesting new session ...")
   session = app.newSession ('test', 'test')
 
-  print "fetching all persons..."
+  print _("fetching all persons...")
   session.setcontext ('address')
   list = session.find ('person', sort = ['address_name'],
                        properties = ['address_name', 'address_street'])
 
-  print 'Found %d instances.' % len (list)
+  print _('Found %d instances.') % len (list)
 
   for person in list:
     print '-' * 79
-    print 'Name: ' + repr (person.name)
-    print 'Street: ' + repr (person.address_street)
-    print 'City: ' + repr (person.address_city)
+    print _('Name   : %s') % repr (person.name)
+    print _('Street : %s') % repr (person.address_street)
+    print _('City   : %s') % repr (person.address_city)
+
     if person.address_country is not None:
-      print 'Country: ' + repr (person.address_country.address_name)
-    print 'Number of Children: ' + repr (person.address_children)
-    print 'Weight: ' + repr (person.address_weight)
-    print 'Born: ' + repr (person.address_born)
-    print 'Human: ' + repr (person.address_human)
+      print _('Country: %s') % repr (person.address_country.address_name)
 
+    print _('Number of Children: %s') % repr (person.address_children)
+    print _('Weight: %s') % repr (person.address_weight)
+    print _('Born  : %s') % repr (person.address_born)
+    print _('Human : %s') % repr (person.address_human)
+

Modified: trunk/gnue-appserver/src/test.py
===================================================================
--- trunk/gnue-appserver/src/test.py    2004-03-04 18:24:54 UTC (rev 5219)
+++ trunk/gnue-appserver/src/test.py    2004-03-04 18:39:17 UTC (rev 5220)
@@ -46,7 +46,7 @@
   def getSessionManager (self):
     self.connections.setLoginHandler (testLoginHandler ())
 
-    print "Creating session manager ..."
+    print _("Creating session manager ...")
     sm = geasSessionManager (self.connections)
 
     return sm
@@ -58,28 +58,28 @@
   def run (self):
     sm = self.getSessionManager ()
 
-    print "Opening session ..."
+    print _("Opening session ...")
     session = sm.open ({"user":"hacker", "password":"secret"})
 
-    print "Creating and populating list object ..."
+    print _("Creating and populating list object ...")
     list = sm.request (session, "address_person", [], ["address_zip"],
                        ["address_name", "address_street", "address_city"])
 
-    print "Retrieving first instance ..."
+    print _("Retrieving first instance ...")
     rset = sm.fetch (session,list,0,1)
 
-    print "These are the values of the first instance:"
-    print "  Name  :", rset[0][1]
-    print "  Street:", rset[0][2]
-    print "  City  :", rset[0][3]
+    print _("These are the values of the first instance:")
+    print _("  Name  :"), rset[0][1]
+    print _("  Street:"), rset[0][2]
+    print _("  City  :"), rset[0][3]
 
-    print "Now I call the procedure 'show' for the first instance:"
+    print _("Now I call the procedure 'show' for the first instance:")
     sm.call (session, "address_person", [rset[0][0]], "address_show", "")
 
-    print "Now I call the procedure 'test' for the first instance:"
+    print _("Now I call the procedure 'test' for the first instance:")
     sm.call (session, "address_person", [rset[0][0]], "address_test", "")
 
-    print "Committing and closing session ..."
+    print _("Committing and closing session ...")
     sm.close (session, 1)
 
 
@@ -97,4 +97,4 @@
 # =============================================================================
 if __name__ == "__main__":
   testApp().run()
-  print "Thank you for playing!"
+  print _("Thank you for playing!")

Modified: trunk/gnue-appserver/src/testRPC.py
===================================================================
--- trunk/gnue-appserver/src/testRPC.py 2004-03-04 18:24:54 UTC (rev 5219)
+++ trunk/gnue-appserver/src/testRPC.py 2004-03-04 18:39:17 UTC (rev 5220)
@@ -19,7 +19,7 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# $Id: testRPC.py,v 1.3 2003/10/15 14:03:38 siesel Exp $
+# $Id$
 
 from gnue.common.rpc import GComm
 import test
@@ -44,10 +44,10 @@
   # ---------------------------------------------------------------------------
 
   def getSessionManager (self):
-    print "Opening RPC connection ..."
+    print _("Opening RPC connection ...")
     server = GComm.attach (self.type, self.params)
 
-    print "Setup an link to the session manager"
+    print _("Setup an link to the session manager")
     sm = server.request ("Session")
 
     return sm
@@ -65,4 +65,4 @@
       app.setConnection('pyro',{})
   
   app.run()
-  print "Thank you for playing!"
+  print _("Thank you for playing!")





reply via email to

[Prev in Thread] Current Thread [Next in Thread]