commit-gnue
[Top][All Lists]
Advanced

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

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


From: johannes
Subject: r5329 - in trunk/gnue-appserver/src: . classrep language
Date: Tue, 16 Mar 2004 08:54:05 -0600 (CST)

Author: johannes
Date: 2004-03-16 08:54:04 -0600 (Tue, 16 Mar 2004)
New Revision: 5329

Removed:
   trunk/gnue-appserver/src/language/Exceptions.py
Modified:
   trunk/gnue-appserver/src/classrep/Base.py
   trunk/gnue-appserver/src/classrep/Class.py
   trunk/gnue-appserver/src/classrep/Definition.py
   trunk/gnue-appserver/src/classrep/Module.py
   trunk/gnue-appserver/src/classrep/Namespace.py
   trunk/gnue-appserver/src/classrep/Procedure.py
   trunk/gnue-appserver/src/classrep/Property.py
   trunk/gnue-appserver/src/classrep/SchemaSupport.py
   trunk/gnue-appserver/src/classrep/__init__.py
   trunk/gnue-appserver/src/classrep/repository.ini
   trunk/gnue-appserver/src/geasGsdGen.py
   trunk/gnue-appserver/src/language/Object.py
   trunk/gnue-appserver/src/language/ObjectList.py
   trunk/gnue-appserver/src/language/Session.py
Log:
Reference properties in class repository are 'real' references now. Added a
'gnue_nullable' property to the repository, and changed gnue-gsdgen to support
this new property. Renamed all exceptions from EFooBar to FooBarError.


Modified: trunk/gnue-appserver/src/classrep/Base.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Base.py   2004-03-16 05:46:28 UTC (rev 
5328)
+++ trunk/gnue-appserver/src/classrep/Base.py   2004-03-16 14:54:04 UTC (rev 
5329)
@@ -23,35 +23,72 @@
 
 import types
 from gnue.appserver.language.Object import Object
-from Namespace import *
 
 # =============================================================================
+# Exceptions
+# =============================================================================
+
+class ClassRepositoryError (Exception):
+  """
+  This Exception is the base class for all repository exceptions
+  """
+  def __init__ (self, text):
+    Exception.__init__ (self, text)
+
+
+class ItemNotFoundError (ClassRepositoryError):
+  """
+  This is the base exception class for all 'item not found' errors
+  """
+  def __init__ (self, key):
+    ClassRepositoryError.__init__ (self, _("Item '%s' not found.") % key)
+
+
+
+# =============================================================================
 # Class-wrapper for dictionaries
 # =============================================================================
 
 class BaseDictionary:
+  """
+  This class implements the common behaviour of class repository dictionaries.
+  """
 
   # ---------------------------------------------------------------------------
   # Construct an instance 
   # ---------------------------------------------------------------------------
+
   def __init__ (self, session, tablename):
     self.table    = tablename
     self._session = session
     self._items   = {}
 
+
   # ---------------------------------------------------------------------------
   # Reload the dictionary from the database by merging new records in
   # ---------------------------------------------------------------------------
+
   def reload (self):
+    """
+    This function fetches a list of all available items of the dictionaries
+    table and merges them into the objectlist.
+    """
     rlist = self._session.find (self.table, self._getReloadCondition (),
                                             self._getSortorder (),
                                             self._getColumns ())
     self.mergeIntoList (rlist)
 
+
   # ---------------------------------------------------------------------------
   # Merge a given object list with the dictionaries list
   # ---------------------------------------------------------------------------
+
   def mergeIntoList (self, addList):
+    """
+    Merge all language interface objects from @addList into the dictionaries
+    objectlist. If an object is new in the list, use _getNewItem () to build a
+    new instance for the object.
+    """
     for obj in addList:  
       found = 0
 
@@ -64,75 +101,145 @@
         newItem = self._getNewItem (obj)
         self._items [newItem.fullName] = newItem
 
+
   # ---------------------------------------------------------------------------
   # Return the conditions to be used on reload ()
   # ---------------------------------------------------------------------------
+
   def _getReloadCondition (self):
+    """
+    Descendants override this method to specify a condition for reloading all
+    elements of the dictionary.
+    """
     return []
 
+
   # ---------------------------------------------------------------------------
   # Return the list of columns to be used on reload ()
   # ---------------------------------------------------------------------------
+
   def _getColumns (self):
+    """
+    Specify a list of fields to be fetched on a reload ().
+    """
     return [u'gnue_name']
 
+
   # ---------------------------------------------------------------------------
   # Return the sortorder to be used on reload ()
   # ---------------------------------------------------------------------------
+
   def _getSortorder (self):
+    """
+    Specify a list of fields used as sort-order.
+    """
     return [u'gnue_id']
 
+
   # ---------------------------------------------------------------------------
   # Get a condition to fetch a single item for the dictionary
   # ---------------------------------------------------------------------------
+
   def _getSingleCondition (self, key):
-    return EClassRepository (_("%s: _getSingleCondition() not implemented!") %
-                             self.table)
+    """
+    Descendants override this method to specify a condition for fetching a
+    single item given by @key.
+    """
+    raise ClassRepositoryError ( \
+           _("%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)
+    """
+    Descendants override this method to create an apropriate instance out of
+    @obj, which is a language interface object.
+    """
+    raise ClassRepositoryError ( \
+           _("%s: _getNewItem() not implemented!") % self.table)
 
+
   # ---------------------------------------------------------------------------
   # Return all keys 
   # ---------------------------------------------------------------------------
+
   def keys (self):
+    """
+    This function returns all keys of the dictionary.
+    """
     keys = self._items.keys ()
     keys.sort ()
     return keys
 
+
   # ---------------------------------------------------------------------------
   # Return all values
   # ---------------------------------------------------------------------------
+
   def values (self):
+    """
+    This function returns all values of the dictionary.
+    """
     keys = self.keys ()
     return map (self._items.get, keys)
 
+
   # ---------------------------------------------------------------------------
   # Return all key-value-pairs
   # ---------------------------------------------------------------------------
+
   def items (self):
+    """
+    This function returns all items of the dictionary.
+    """
     return self._items.items ()
 
+
   # ---------------------------------------------------------------------------
   # Check for a specified key
   # ---------------------------------------------------------------------------
+
   def has_key (self, key):
+    """
+    This function returns True, if the key @key is available in the dictionary.
+    """
     return self._items.has_key (key)
 
+
   # ---------------------------------------------------------------------------
+  # Virtual: Create an exception 'item not found error'
+  # ---------------------------------------------------------------------------
+  def _itemNotFoundError (self, key):
+    """
+    A descendant of this class can override this function to return an
+    appropriate exception.
+    """
+    return ItemNotFoundError (key)
+
+
+  # ---------------------------------------------------------------------------
   # Return the number of items in the dictionary
   # ---------------------------------------------------------------------------
   def __len__ (self):
+    """
+    Return the number of items in the dictionary
+    """
     return len (self._items)
 
+
   # ---------------------------------------------------------------------------
   # Access to the underlying dictionary
   # ---------------------------------------------------------------------------
+
   def __getitem__ (self, key):
+    """
+    This function provides access to the underlying dictionary. If a key isn't
+    found in the dictionary, it will be looked up via language interface. If
+    it is not found in the datasource, an _itemNotFoundError will be raised.
+    """
     if self._items.has_key (key):
       return self._items [key]
     else:
@@ -143,7 +250,7 @@
         self._items [key] = self._getNewItem (list [0])
         return self._items [key]
 
-    raise self.__class__._notFoundException (key)
+    raise self._itemNotFoundError (key)
 
 
 
@@ -151,10 +258,14 @@
 # This class maps all dictionary-keys to properties
 # =============================================================================
 class BaseObject:
+  """
+  This class implements the basic dictionary element class.
+  """
 
   # ---------------------------------------------------------------------------
   # Constructor
   # ---------------------------------------------------------------------------
+
   def __init__ (self, session, classname, aObject = None, pDefs = None):
     self.classname    = classname
     self._session     = session
@@ -165,24 +276,58 @@
     if pDefs is not None:
       for key in pDefs.keys ():
         if key in ["gnue_length", "gnue_scale"]:
-          self.__predefined [key] = int (pDefs [key])
+          if pDefs [key] is None:
+            self.__predefined [key] = 0
+          else:
+            self.__predefined [key] = int (pDefs [key])
+        elif key in ["gnue_nullable"]:
+          if pDefs [key] == "FALSE":
+            self.__predefined [key] = False
+          else:
+            self.__predefined [key] = True
         else:
           self.__predefined [key] = pDefs [key]
 
+
   # ---------------------------------------------------------------------------
   # Return an attributes value
   # ---------------------------------------------------------------------------
+
   def __getattr__ (self, attr):
+    """
+    If an attribute is not a 'predefined' value it is delegated to the language
+    interface object of the instance.
+    """
     if self.__predefined.has_key (attr):
       return self.__predefined [attr]
     else:
-      return getattr (self.__getObject (), attr)
+      return getattr (self._getObject (), attr)
 
+
   # ---------------------------------------------------------------------------
   # Get a language interface object
   # ---------------------------------------------------------------------------
-  def __getObject (self):
+
+  def _getObject (self):
+    """
+    This function returns the corresponding language interface object of this
+    instance. It will be created the first time this function is called.
+    """
     if self.__object is None:
       self.__object = Object (self._session, self.classname, self.gnue_id)
 
     return self.__object
+
+
+  # ---------------------------------------------------------------------------
+  # Update object references
+  # ---------------------------------------------------------------------------
+
+  def replaceReferences (self, aObject):
+    """
+    This function replaces all references to @aObject in it's predefined
+    dictionary.
+    """
+    for (key, value) in self.__predefined.items ():
+      if isinstance (value, types.UnicodeType) and value == aObject.objectId:
+        self.__predefined [key] = aObject

Modified: trunk/gnue-appserver/src/classrep/Class.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Class.py  2004-03-16 05:46:28 UTC (rev 
5328)
+++ trunk/gnue-appserver/src/classrep/Class.py  2004-03-16 14:54:04 UTC (rev 
5329)
@@ -21,22 +21,37 @@
 #
 # $Id$
 
-import types
 from Base import *
-from Namespace import *
 from Property import *
 from Procedure import *
+from Namespace import createName, splitName
 
+
 # =============================================================================
+# Exceptions
+# =============================================================================
+
+class ClassNotFoundError (ClassRepositoryError):
+  """
+  Referenced class not found in repository
+  """
+  def __init__ (self, classname):
+    msg = _("Class '%s' not found in class repository") % classname
+    ClassRepositoryError.__init__ (self, msg)
+
+
+# =============================================================================
 # Dictionary with classes
 # =============================================================================
 class ClassDict (BaseDictionary):
+  """
+  This class implements a dictionary of classes in the class repository.
+  """
 
-  _notFoundException = EClassNotFound
-
   # ---------------------------------------------------------------------------
   # Create a dictionary with all classes [from a specified module]
   # ---------------------------------------------------------------------------
+
   def __init__ (self, session, moduleDict, module = None, predefines = None):
     BaseDictionary.__init__ (self, session, 'gnue_class')
 
@@ -62,15 +77,23 @@
             self._items [item.fullName] = item
       else:
         # fetch a fresh copy from the datasource
+        #
+        # NOTE: this won't happen very often, since it is only called if a
+        # module requests a list of all classes without having it's own
+        # ClassDict-instance.
         self.reload ()
 
 
   # ---------------------------------------------------------------------------
   # Reload the dictionary and run nested reloads for all classes 
   # ---------------------------------------------------------------------------
+
   def reload (self):
+    """
+    This function reloads all available classes of a module, and all their
+    properties and procedures.
+    """
     BaseDictionary.reload (self)
-
     for aClass in self.values ():
       aClass.properties.reload ()
       aClass.procedures.reload ()
@@ -79,10 +102,14 @@
   # ---------------------------------------------------------------------------
   # Create a new instance for a dictionary-item
   # ---------------------------------------------------------------------------
-  def _getNewItem (self, object):
-    module = self.modules.find (object.gnue_module.objectId)
-    c = Class (self._session, self, module, object,
-               {"gnue_id": object.objectId})
+
+  def _getNewItem (self, aObject):
+    """
+    Create a new instance of a class and reload it's properties and procedures.
+    """
+    module = self.modules.find (aObject.gnue_module.objectId)
+    c = Class (self._session, self, module, aObject,
+               {"gnue_id": aObject.objectId})
     c.properties.reload ()
     c.procedures.reload ()
     return c
@@ -91,9 +118,14 @@
   # ---------------------------------------------------------------------------
   # Get an apropriate reload ()-condition
   # ---------------------------------------------------------------------------
+
   def _getReloadCondition (self):
+    """
+    If this class dictionary is bound to a module, the reload condition matches
+    all classes of the bound module, otherwise no condition is given.
+    """
     if self.__module is not None:
-      return [["eq", ""], ["field", "gnue_module"], 
+      return [["eq", ""], ["field", u"gnue_module"], 
              ["const", self.__module.gnue_id]]
     else:
       return []
@@ -102,19 +134,38 @@
   # ---------------------------------------------------------------------------
   # Create a condition to retrieve the klass specified by 'key'
   # ---------------------------------------------------------------------------
+
   def _getSingleCondition (self, key):
+    """
+    A single class is identified by it's modules gnue_id and the classname.
+    """
     (moduleName, className) = splitName (key)
     module = self.modules [moduleName]
 
-    return [["eq", ""], ["field", "gnue_module"], ["const", module.gnue_id],
-            ["eq", ""], ["field", "gnue_name"], ["const", className]]
+    return [["eq", ""], ["field", u"gnue_module"], ["const", module.gnue_id],
+            ["eq", ""], ["field", u"gnue_name"], ["const", className]]
 
 
   # ---------------------------------------------------------------------------
+  # Create a key-error exception
+  # ---------------------------------------------------------------------------
+
+  def _itemNotFoundError (self, key):
+    """
+    Return a ClassNotFoundError if an item cannot be found.
+    """
+    return ClassNotFoundError (key)
+
+
+  # ---------------------------------------------------------------------------
   # On find () this dictionary will prepare the following columns ()
   # ---------------------------------------------------------------------------
+
   def _getColumns (self):
-    return ["gnue_module", "gnue_name"]
+    """
+    Fields to be fetched on reloads.
+    """
+    return [u"gnue_module", u"gnue_name"]
 
 
 
@@ -126,6 +177,7 @@
   # ---------------------------------------------------------------------------
   # Wrapping a business object class
   # ---------------------------------------------------------------------------
+
   def __init__ (self, session, classDict, module, object, predefs = None, 
                 propDefList = None):
     BaseObject.__init__ (self, session, 'gnue_class', object, predefs)
@@ -142,12 +194,41 @@
   # ---------------------------------------------------------------------------
   # Return a property by name
   # ---------------------------------------------------------------------------
+
   def findProp (self, name):
+    """
+    Find a property @name.
+    """
     return self.properties [name]
 
+
   # ---------------------------------------------------------------------------
   # Return a procedure by name
   # ---------------------------------------------------------------------------
+
   def findProc (self, name):
+    """
+    Find a procedure @name.
+    """
     return self.procedures [name]
            
+
+  # ---------------------------------------------------------------------------
+  # Replace references
+  # ---------------------------------------------------------------------------
+
+  def replaceReferences (self, module):
+    """
+    This class updates all references of a class to it's module object and
+    requests all properties and procedures to do update their references too.
+    """
+    BaseObject.replaceReferences (self, module)
+
+    me = self._getObject ()
+    for prop in self.properties.values ():
+      prop.replaceReferences (module)
+      prop.replaceReferences (me)
+
+    for proc in self.procedures.values ():
+      proc.replaceReferences (module)
+      proc.replaceReferences (me)

Modified: trunk/gnue-appserver/src/classrep/Definition.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Definition.py     2004-03-16 05:46:28 UTC 
(rev 5328)
+++ trunk/gnue-appserver/src/classrep/Definition.py     2004-03-16 14:54:04 UTC 
(rev 5329)
@@ -25,10 +25,21 @@
 import string
 import os
 
-from Base import BaseObject
+from Base import ClassRepositoryError
 from Namespace import *
 
+# =============================================================================
+# Exceptions
+# =============================================================================
 
+class InvalidDefinitionError (ClassRepositoryError):
+  """
+  This exception is raised on an invalid repository definition file
+  """
+  def __init__ (self, text):
+    ClassRepositoryError (text)
+    
+
 # =============================================================================
 # A wrapper around a class repository definition file
 # =============================================================================
@@ -40,7 +51,7 @@
   def __init__ (self, filename):
     self.filename = filename
     if not os.path.isfile (filename):
-      raise Exception, _("Cannot find file '%s'") % filename
+      raise ClassRepositoryError (_("Cannot find file '%s'") % filename)
 
     self.parser   = ConfigParser.ConfigParser ()
     self.parser.read (self.filename)
@@ -60,6 +71,8 @@
       data = {}
       for option in self.parser.options (section):
        u = unicode (self.parser.get (section, option))
+        if u == "":
+          u = None
        data [string.lower (option)] = u
 
       identifier = unicode (string.lower (section))
@@ -75,22 +88,23 @@
        self._properties [identifier] = data
 
       else:
-       raise EInvalidDefinition (_("Invalid identifier '%s'.") % identifier)
+       raise InvalidDefinitionError ( \
+                _("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 InvalidDefinitionError (_("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 InvalidDefinitionError (_("Class '%s' not found") % klass)
 
       (module, item) = splitName (property)
       if not self._modules.has_key (module):
-       raise EInvalidDefinition (_("Module '%s' not found.") % module)
+       raise InvalidDefinitionError (_("Module '%s' not found") % module)
 
   # ---------------------------------------------------------------------------
   # return a list of modules defined in the configuration file

Modified: trunk/gnue-appserver/src/classrep/Module.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Module.py 2004-03-16 05:46:28 UTC (rev 
5328)
+++ trunk/gnue-appserver/src/classrep/Module.py 2004-03-16 14:54:04 UTC (rev 
5329)
@@ -21,25 +21,39 @@
 #
 # $Id$
 
-import types
 from Base import *
-from Namespace import *
 from Class import ClassDict
 
+
 # =============================================================================
+# Exceptions
+# =============================================================================
+
+class ModuleNotFoundError (ClassRepositoryError):
+  """
+  This exception is raised if a non-existend module was called
+  """
+  def __init__ (self, module):
+    msg = _("Module '%s' not found in class repository.") % module
+    ClassRepositoryError.__init__ (self, msg)
+    
+
+# =============================================================================
 # A List Of Business Object Modules
 # =============================================================================
 
 class ModuleDict (BaseDictionary):
+  """
+  This class implements a dictionary of all modules in the class repository.
+  """
 
-  _notFoundException = EModuleNotFound
-
   # ---------------------------------------------------------------------------
-  # This class behaves like a dictionary of all available modules with the
-  # keys being the module names and the values being Module objects.
+  # Constructor
   # ---------------------------------------------------------------------------
+
   def __init__ (self, session, predefines = None):
     BaseDictionary.__init__ (self, session, 'gnue_module')
+    self.classdict = None
 
     # Note: this 'predefines' is a RepositoryDefinition
     if predefines is not None:
@@ -47,46 +61,85 @@
         module = Module (self._session, self, None, mDict)
         self._items [module.fullName] = module
 
+
   # ---------------------------------------------------------------------------
   # Create a new module instance
   # ---------------------------------------------------------------------------
+
   def _getNewItem (self, aObject):
+    """
+    Create a new module instance, using @aObject's objectId as
+    'gnue_id'-predefine.
+    """
     return Module (self._session, self, aObject, {"gnue_id": aObject.objectId})
 
+
   # ---------------------------------------------------------------------------
   # Create a condition to reload a single module
   # ---------------------------------------------------------------------------
+
   def _getSingleCondition (self, key):
+    """
+    Match a single module by it's name.
+    """
     return [["eq", ""], ["field", "gnue_name"], ["const", key]]
 
+
   # ---------------------------------------------------------------------------
+  # Create an appropriate itemNotFound error
+  # ---------------------------------------------------------------------------
+
+  def _itemNotFoundError (self, key):
+    """
+    An _itemNotFoundError is a 'ModuleNotFoundError'
+    """
+    return ModuleNotFoundError (key)
+
+
+  # ---------------------------------------------------------------------------
   # Find a listed module by its id
   # ---------------------------------------------------------------------------
+
   def find (self, moduleId):
+    """
+    This function searches for a module which gnue_id is @moduleId.
+    """
     for mod in self.values ():
       if mod.gnue_id == moduleId:
         return mod
     return None
 
 
+
 # =============================================================================
 # A Business Object Module
 # =============================================================================
+
 class Module (BaseObject):
+  """
+  This class implements a module in the class dictionary.
+  """
 
   # ---------------------------------------------------------------------------
   # Constructor
   # ---------------------------------------------------------------------------
+
   def __init__ (self, session, mDict, aObject = None, pDefs = None):
     BaseObject.__init__ (self, session, 'gnue_module', aObject, pDefs)
 
     self.modules  = mDict
     self.fullName = self.gnue_name
 
+
   # ---------------------------------------------------------------------------
   # Return an attribute's value
   # ---------------------------------------------------------------------------
   def __getattr__ (self, attr):
+    """
+    The first time the attribute 'classes' is used, a class dictionary with all
+    classes of this module will be created. All other attributes are delegated
+    to the BaseObject's __getattr__ ().
+    """
     if attr == 'classes':
       self.__dict__ ['classes'] = ClassDict (self._session, self.modules, self)
 
@@ -97,3 +150,19 @@
     else:
       return BaseObject.__getattr__ (self, attr)
 
+
+  # ---------------------------------------------------------------------------
+  # replace module references
+  # ---------------------------------------------------------------------------
+
+  def replaceReferences (self, classes):
+    """
+    This function iterates over all classes in the given class dictionary and
+    replaces their 'string-type' references to this module instance with this
+    modules language interface object.
+    """
+    me = self._getObject ()
+
+    for aClass in classes.values ():
+      aClass.replaceReferences (me)
+

Modified: trunk/gnue-appserver/src/classrep/Namespace.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Namespace.py      2004-03-16 05:46:28 UTC 
(rev 5328)
+++ trunk/gnue-appserver/src/classrep/Namespace.py      2004-03-16 14:54:04 UTC 
(rev 5329)
@@ -22,79 +22,19 @@
 # $Id$
 
 import string
+from Base import ClassRepositoryError
 
 # =============================================================================
-# Base class for all class-repository exceptions
+# Exceptions
 # =============================================================================
-class EClassRepository (Exception):
-  def __init__ (self, text):
-    self._msg = text
-    Exception.__init__ (self, self._msg)
 
-  def __repr__ (self):
-    return self._msg
-
-# =============================================================================
-# Malformed names
-# =============================================================================
-class EInvalidName (EClassRepository):
+class InvalidNameError (ClassRepositoryError):
   def __init__ (self, name):
     msg = _("'%s' is not a valid, fully qualified identifier.") % name
-    EClassRepository.__init__ (self, msg)
+    ClassRepositoryError.__init__ (self, msg)
 
 
 # =============================================================================
-# Object references a non-existing id
-# =============================================================================
-class EBadReference (EClassRepository):
-  def __init__ (self, item, reference):
-    msg = _("Reference %(reference)s of object %(item)s is invalid.") % \
-           { "reference": reference, "item": item}
-    EClassRepository.__init__ (self, msg)
-
-# =============================================================================
-# Requested module does not exist
-# =============================================================================
-class EModuleNotFound (EClassRepository):
-  def __init__ (self, module):
-    msg = _("Module '%s' not found in class repository.") % module
-    EClassRepository.__init__ (self, msg)
-
-# =============================================================================
-# Requested class does not exist
-# =============================================================================
-class EClassNotFound (EClassRepository):
-  def __init__ (self, klass):
-    msg = _("Class '%s' not found in class repository.") % klass
-    EClassRepository.__init__ (self, msg)
-
-# =============================================================================
-# Requested property does not exist
-# =============================================================================
-class EPropertyNotFound (EClassRepository):
-  def __init__ (self, classname, property):
-    msg = _("Class '%(classname)s' has no property '%(property)s'.") % \
-            { "classname": classname, "property": property }
-    EClassRepository.__init__ (self, msg)
-
-# =============================================================================
-# Requested procedure does not exist
-# =============================================================================
-class EProcedureNotFound (EClassRepository):
-  def __init__ (self, classname, procedure):
-    msg = _("Class '%(classname)s' has no procedure '%(procedure)s'.") % \
-           { "classname": classname, "procedure": procedure }
-    EClassRepository.__init__ (self, msg)
-
-# =============================================================================
-# Class repository definition file has an invalid structure
-# =============================================================================
-class EInvalidDefinition (EClassRepository):
-  def __init__ (self, text):
-    msg = _("Invalid repository definition: %s") % text
-    EClassRepository.__init__ (self, msg)
-
-# =============================================================================
 # Namespace constants
 # =============================================================================
 
@@ -115,7 +55,7 @@
   elif len (parts) == 2:
     return (parts [0], parts [1])
 
-  raise EInvalidName (name)
+  raise InvalidNameError (name)
 
 # -----------------------------------------------------------------------------
 # Create a fully qualified name from a namespace and an identifier

Modified: trunk/gnue-appserver/src/classrep/Procedure.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Procedure.py      2004-03-16 05:46:28 UTC 
(rev 5328)
+++ trunk/gnue-appserver/src/classrep/Procedure.py      2004-03-16 14:54:04 UTC 
(rev 5329)
@@ -21,17 +21,25 @@
 #
 # $Id$
 
-import types
 from Base import *
-from Namespace import *
+from Namespace import createName, splitName
 
 # =============================================================================
+# Exceptions
+# =============================================================================
+
+class ProcedureNotFoundError (ClassRepositoryError):
+  def __init__ (self, classname, procedure):
+    msg = _("Class '%(classname)s' has no procedure '%(procedure)s'") % \
+           { "classname": classname, "procedure": procedure }
+    ClassRepositoryError.__init__ (self, msg)
+
+
+# =============================================================================
 # Dictionary with all properties of a given class
 # =============================================================================
 class ProcedureDict (BaseDictionary):
 
-  _notFoundException = EProcedureNotFound
-
   # ---------------------------------------------------------------------------
   # Construct a Procedure-Dictionary for class aClass
   # ---------------------------------------------------------------------------
@@ -45,9 +53,10 @@
   # ---------------------------------------------------------------------------
   # Create a new instance of a dictionary item
   # ---------------------------------------------------------------------------
-  def _getNewItem (self, object):
-    pMod = self.__module.modules.find (object.gnue_module.objectId)
-    return Procedure (self._session, pMod, object, {"gnue_id": 
object.objectId})
+  def _getNewItem (self, aObject):
+    pMod = self.__module.modules.find (aObject.gnue_module.objectId)
+    return Procedure (self._session, pMod, aObject, 
+                      {"gnue_id": aObject.objectId})
 
 
   # ---------------------------------------------------------------------------
@@ -73,8 +82,13 @@
   # Get a list of columns to be prepared on a find () 
   # ---------------------------------------------------------------------------
   def _getColumns (self):
-    return ["gnue_module", "gnue_class", "gnue_name", "gnue_language"]
+    return [u"gnue_module", u"gnue_class", u"gnue_name", u"gnue_language"]
 
+  # ---------------------------------------------------------------------------
+  # Create a key-not-found exception
+  # ---------------------------------------------------------------------------
+  def _itemNotFoundError (self, key):
+    return ProcedureNotFoundError (self.__class.fullName, key)
 
 
 # =============================================================================
@@ -90,3 +104,4 @@
 
     self.module   = module
     self.fullName = createName (module.gnue_name, self.gnue_name)
+

Modified: trunk/gnue-appserver/src/classrep/Property.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Property.py       2004-03-16 05:46:28 UTC 
(rev 5328)
+++ trunk/gnue-appserver/src/classrep/Property.py       2004-03-16 14:54:04 UTC 
(rev 5329)
@@ -21,17 +21,26 @@
 #
 # $Id$
 
-import types
 from Base import *
-from Namespace import *
+from Namespace import createName
 
+
 # =============================================================================
+# Exceptions
+# =============================================================================
+
+class PropertyNotFoundError (ClassRepositoryError):
+  def __init__ (self, classname, key):
+    msg = _("Class '%(classname)s' has no property '%(property)s'") % \
+            { "classname": classname, "property": key }
+    ClassRepositoryError.__init__ (self, msg)
+
+
+# =============================================================================
 # Dictionary with all properties of a given class
 # =============================================================================
 class PropertyDict (BaseDictionary):
 
-  _notFoundException = EPropertyNotFound
-
   # ---------------------------------------------------------------------------
   # Construct a Property-Dictionary for class aClass
   # ---------------------------------------------------------------------------
@@ -53,16 +62,17 @@
   # ---------------------------------------------------------------------------
   # Create a new instance of a dictionary item
   # ---------------------------------------------------------------------------
-  def _getNewItem (self, object):
-    pMod = self.__module.modules.find (object.gnue_module.objectId)
-    return Property (self._session, pMod, object, {"gnue_id": object.objectId})
+  def _getNewItem (self, aObject):
+    pMod = self.__module.modules.find (aObject.gnue_module.objectId)
+    return Property (self._session, pMod, aObject, 
+                     {"gnue_id": aObject.objectId})
 
 
   # ---------------------------------------------------------------------------
   # Restrict a reload () to the classes properties 
   # ---------------------------------------------------------------------------
   def _getReloadCondition (self):
-    return [["eq", ""], ["field", "gnue_class"], 
+    return [["eq", ""], ["field", u"gnue_class"], 
             ["const", self.__class.gnue_id]]
 
 
@@ -70,20 +80,26 @@
   # Return a condition to match a given Property
   # ---------------------------------------------------------------------------
   def _getSingleCondition (self, key):
-    return [["eq", ""], ["field", "gnue_class"], 
+    return [["eq", ""], ["field", u"gnue_class"], 
             ["const", self.__class.gnue_id],
-            ["eq", ""], ["field", "gnue_name"], ["const", key]]
+            ["eq", ""], ["field", u"gnue_name"], ["const", key]]
 
 
   # ---------------------------------------------------------------------------
   # Return a list of columns to be prepared by a find ()
   # ---------------------------------------------------------------------------
   def _getColumns (self):
-    return ["gnue_class", "gnue_module", "gnue_name", "gnue_type",
-            "gnue_length", "gnue_scale", "gnue_comment"]
+    return [u"gnue_module", u"gnue_class", u"gnue_name", u"gnue_type",
+            u"gnue_length", u"gnue_scale", u"gnue_comment"]
 
 
+  # ---------------------------------------------------------------------------
+  # Create a key-not-found-exception
+  # ---------------------------------------------------------------------------
+  def _itemNotFoundError (self, key):
+    return PropertyNotFoundError (self.__class.fullName, key)
 
+
 # =============================================================================
 # A Business Object Property
 # =============================================================================
@@ -104,12 +120,6 @@
     self.fullName = createName (self.module.gnue_name, self.gnue_name)
     self.column   = self.fullName
 
-    if self.gnue_length is None:
-      self.gnue_length = 0
-
-    if self.gnue_scale is None:
-      self.gnue_scale = 0
-
     # build database specific type information
     if self.gnue_type in self._BASE_TYPES:
       self.dbType   = self.gnue_type
@@ -151,3 +161,4 @@
                                                        int (self.gnue_scale))
     else:
       self.fullType = self.gnue_type
+

Modified: trunk/gnue-appserver/src/classrep/SchemaSupport.py
===================================================================
--- trunk/gnue-appserver/src/classrep/SchemaSupport.py  2004-03-16 05:46:28 UTC 
(rev 5328)
+++ trunk/gnue-appserver/src/classrep/SchemaSupport.py  2004-03-16 14:54:04 UTC 
(rev 5329)
@@ -34,29 +34,27 @@
 # =============================================================================
 # Exceptions: Base exception class
 # =============================================================================
-class ESchemaSupport (Exception):
+
+class SchemaSupportError (Exception):
+  """
+  Base class for all exceptions of SchemaSupport
+  """
   def __init__ (self, text):
-    self.__msg = text
     Exception.__init__ (self, text)
 
-  def __repr__ (self):
-    return self.__msg
 
+class InvalidTypeError (SchemaSupportError):
+  def __init__ (self, typename):
+    msg = _("Invalid export type: '%s'") % typename
+    SchemaSupportError.__init__ (self, msg)
 
-# =============================================================================
-# Exceptions: Invalid export type
-# =============================================================================
-class EInvalidType (ESchemaSupport):
-  def __init__ (self, etype):
-    ESchemaSupport.__init__ (self, _("Invalid export type: '%s'.") % etype)
 
-
-class EInvalidValue (ESchemaSupport):
+class InvalidValueError (SchemaSupportError):
   """
-  EInvalidValue is raised if a value doesn't match it's datatype.
+  This exception is raised if a value doesn't match it's datatype.
   """
   def __init__ (self, text):
-    ESchemaSupport.__init__ (self, text)
+    SchemaSupportError.__init__ (self, text)
 
 
 # =============================================================================
@@ -82,7 +80,7 @@
       wtype = "both"
 
     elif wtype.lower () not in self.SCHEMA_STORE:
-      raise EInvalidType (wtype.lower ())
+      raise InvalidTypeError (wtype.lower ())
 
     # If no specific items are requested, we will use classes
     if items is None or len (items) == 0:
@@ -103,7 +101,7 @@
 
         # otherwise item is of no use to us
         else:
-          raise Namespace.EInvalidName (item)
+          raise Namespace.InvalidNameError (item)
 
     schema = GSSchema()
     schema.title   = "Appserver Schema Dump"
@@ -157,7 +155,7 @@
       field.precision   = int (cProp.dbScale)
       if int (cProp.dbLength) > 0:
         field.length = int (cProp.dbLength)
-      if field.name == "gnue_id":
+      if not cProp.gnue_nullable is None and not cProp.gnue_nullable:
         field.nullable = False
 
     # If there is a property 'gnue_id' of type 'id' in a class use it for the
@@ -191,9 +189,9 @@
       mProp = self.__classes ["gnue_module"].properties
       row   = GSRow (modrows)
 
-      self.__buildValue (row, mProp ["gnue_id"]     , moduledef.gnue_id)
-      self.__buildValue (row, mProp ["gnue_name"]   , moduledef.gnue_name)
-      self.__buildValue (row, mProp ["gnue_comment"], moduledef.gnue_comment)
+      self.__buildValue (row, mProp [u"gnue_id"]     , moduledef.gnue_id)
+      self.__buildValue (row, mProp [u"gnue_name"]   , moduledef.gnue_name)
+      self.__buildValue (row, mProp [u"gnue_comment"], moduledef.gnue_comment)
 
     # dump all gnue_class rows for the requested tables
     tabledata = GSTableData (gsData)
@@ -232,14 +230,15 @@
         pProp = self.__classes ["gnue_property"].properties
         row = GSRow (proprows)
 
-        self.__buildValue (row, pProp ["gnue_id"]     , propdef.gnue_id)
-        self.__buildValue (row, pProp ["gnue_module"] , propdef.gnue_module)
-        self.__buildValue (row, pProp ["gnue_class"]  , propdef.gnue_class)
-        self.__buildValue (row, pProp ["gnue_name"]   , propdef.gnue_name)
-        self.__buildValue (row, pProp ["gnue_type"]   , propdef.gnue_type)
-        self.__buildValue (row, pProp ["gnue_length"] , propdef.gnue_length)
-        self.__buildValue (row, pProp ["gnue_scale"]  , propdef.gnue_scale)
-        self.__buildValue (row, pProp ["gnue_comment"], propdef.gnue_comment)
+        self.__buildValue (row, pProp ["gnue_id"]      , propdef.gnue_id)
+        self.__buildValue (row, pProp ["gnue_module"]  , propdef.gnue_module)
+        self.__buildValue (row, pProp ["gnue_class"]   , propdef.gnue_class)
+        self.__buildValue (row, pProp ["gnue_name"]    , propdef.gnue_name)
+        self.__buildValue (row, pProp ["gnue_type"]    , propdef.gnue_type)
+        self.__buildValue (row, pProp ["gnue_length"]  , propdef.gnue_length)
+        self.__buildValue (row, pProp ["gnue_scale"]   , propdef.gnue_scale)
+        self.__buildValue (row, pProp ["gnue_comment"] , propdef.gnue_comment)
+        self.__buildValue (row, pProp ["gnue_nullable"], propdef.gnue_nullable)
 
       for procdef in classdef.procedures.values ():
 
@@ -259,9 +258,10 @@
   # Create a new field in a row and populate it with a value
   # ---------------------------------------------------------------------------
   def __buildValue (self, row, prop, data):
-    value = GSValue (row)
-    value.field = prop.column
-    GContent (value, self.__nativeToString (data, prop.fullType))
+    if data is not None:
+      value = GSValue (row)
+      value.field = prop.column
+      GContent (value, self.__nativeToString (data, prop.fullType))
 
 
   # ---------------------------------------------------------------------------
@@ -290,8 +290,6 @@
     file.  The native python object will be treated and theirfore converted as
     'datatype'.
     """
-    _LENGTH_SCALE = re.compile ('^\w+\s*\((\d+)[\.]{0,1}(\d*)\)\s*')
-
     if datatype [:6] == "string" or datatype == "id":
       checktype (native, [NoneType, UnicodeType])
 
@@ -304,34 +302,10 @@
     elif datatype [:6] == "number":
       if native is None:
         return "0"
+      else:
+        return str (native)
 
-      res = str (native)
 
-      fmatch = _LENGTH_SCALE.match (datatype)
-      if fmatch is not None:
-        (fml, fms) = fmatch.groups ()
-
-        flength = int (fml)
-        fscale  = 0
-        if len (fms):
-          fscale = int (fms)
-
-        vmatch = re.compile ('^([+-]{0,1})(\d+)[\.]{0,1}(\d*)$').match (res)
-        if vmatch is None:
-          raise EInvalidValue (_("%s is not a valid number.") % repr (native))
-
-          sign = vmatch.groups () [0]
-          pre  = vmatch.groups () [1]
-          frac = vmatch.groups () [2]
-
-          if len (pre) > (flength-fscale) or len (frac) > fscale:
-            raise EInvalidValue (_(
-"""%(value)s exceeds precision (%(length)d.%(scale)d)""") % \
-                  { "value": repr (native), "length": flength, "scale": 
fscale})
-
-      return res
-
-
     elif datatype == "boolean":
       if native is not None and native:
         return u'TRUE'
@@ -344,7 +318,8 @@
         return native.date
 
       else:
-        raise EInvalidValue (_("%s is not a valid date object") % repr 
(native))
+        raise InvalidValueError ( \
+              _("%s is not a valid date object") % repr (native))
 
 
     elif datatype == "time":
@@ -355,7 +330,8 @@
         return str (native)
 
       else:
-        raise EInvalidValue (_("%s is not a valid time object") % repr 
(native))
+        raise InvalidValueError ( \
+              _("%s is not a valid time object") % repr (native))
 
 
     elif datatype == "datetime":
@@ -363,8 +339,8 @@
         return str (native)
 
       else:
-        raise EInvalidValue (_("%s is not a valid datetime object") % \
-                             repr (native))
+        raise InvalidValueError (_("%s is not a valid datetime object") % \
+                                    repr (native))
 
     else:
       # must be reference property

Modified: trunk/gnue-appserver/src/classrep/__init__.py
===================================================================
--- trunk/gnue-appserver/src/classrep/__init__.py       2004-03-16 05:46:28 UTC 
(rev 5328)
+++ trunk/gnue-appserver/src/classrep/__init__.py       2004-03-16 14:54:04 UTC 
(rev 5329)
@@ -56,9 +56,12 @@
   server.modules = ModuleDict (session, bootcat)
   server.classes = ClassDict (session, server.modules, None, bootcat)
   server.modules.classdict = server.classes
-  
+
+  for module in server.modules.values ():
+    module.replaceReferences (server.classes)
+
   # and finally refresh the repository from the datasource
   server.modules.reload ()
   server.classes.reload ()
- 
+
   return

Modified: trunk/gnue-appserver/src/classrep/repository.ini
===================================================================
--- trunk/gnue-appserver/src/classrep/repository.ini    2004-03-16 05:46:28 UTC 
(rev 5328)
+++ trunk/gnue-appserver/src/classrep/repository.ini    2004-03-16 14:54:04 UTC 
(rev 5329)
@@ -76,6 +76,7 @@
 gnue_length    = 0
 gnue_scale     = 0
 gnue_comment   = Object ID
+gnue_nullable  = FALSE
 
 [gnue_module.gnue_name]
 gnue_id        = 00000000000000000000000000000012
@@ -86,6 +87,7 @@
 gnue_length    = 35
 gnue_scale     = 0
 gnue_comment   = Name
+gnue_nullable  = 
 
 [gnue_module.gnue_comment]
 gnue_id        = 00000000000000000000000000000013
@@ -96,6 +98,7 @@
 gnue_length    = 70
 gnue_scale     = 0
 gnue_comment   = Comment
+gnue_nullable  = 
 
 ; -----------------------------------------------------------------------------
 ; classes
@@ -109,6 +112,7 @@
 gnue_length    = 0
 gnue_scale     = 0
 gnue_comment   = Object ID
+gnue_nullable  = FALSE
 
 [gnue_class.gnue_module]
 gnue_id        = 00000000000000000000000000000022
@@ -119,6 +123,7 @@
 gnue_length    = 0
 gnue_scale     = 0
 gnue_comment   = Module that defined this class
+gnue_nullable  = FALSE
 
 [gnue_class.gnue_name]
 gnue_id        = 00000000000000000000000000000023
@@ -129,6 +134,7 @@
 gnue_length    = 35
 gnue_scale     = 0
 gnue_comment   = Classname without modulename
+gnue_nullable  = 
 
 [gnue_class.gnue_comment]
 gnue_id        = 00000000000000000000000000000024
@@ -139,6 +145,7 @@
 gnue_length    = 70
 gnue_scale     = 0
 gnue_comment   = Comment
+gnue_nullable  = 
 
 ; -----------------------------------------------------------------------------
 ; properties
@@ -152,6 +159,7 @@
 gnue_length    = 0
 gnue_scale     = 0
 gnue_comment   = Object ID
+gnue_nullable  = FALSE
 
 [gnue_property.gnue_class]
 gnue_id        = 00000000000000000000000000000032
@@ -162,6 +170,7 @@
 gnue_length    = 0
 gnue_scale     = 0
 gnue_comment   = Class the property belongs to
+gnue_nullable  = FALSE
 
 [gnue_property.gnue_module]
 gnue_id        = 00000000000000000000000000000033
@@ -172,6 +181,7 @@
 gnue_length    = 0
 gnue_scale     = 0
 gnue_comment   = Module that defined this property
+gnue_nullable  = FALSE
 
 [gnue_property.gnue_name]
 gnue_id        = 00000000000000000000000000000034
@@ -182,6 +192,7 @@
 gnue_length    = 35
 gnue_scale     = 0
 gnue_comment   = Propertyname without modulename
+gnue_nullable  = 
 
 [gnue_property.gnue_type]
 gnue_id        = 00000000000000000000000000000035
@@ -192,6 +203,7 @@
 gnue_length    = 35
 gnue_scale     = 0
 gnue_comment   = Property type 
+gnue_nullable  = 
 
 [gnue_property.gnue_length]
 gnue_id        = 00000000000000000000000000000036
@@ -202,6 +214,7 @@
 gnue_length    = 6
 gnue_scale     = 0
 gnue_comment   = Lenght of the property 
+gnue_nullable  = 
 
 [gnue_property.gnue_scale]
 gnue_id        = 00000000000000000000000000000037
@@ -212,6 +225,7 @@
 gnue_length    = 4
 gnue_scale     = 0
 gnue_comment   = Scale of numeric data
+gnue_nullable  = 
 
 [gnue_property.gnue_comment]
 gnue_id        = 00000000000000000000000000000038
@@ -222,8 +236,20 @@
 gnue_length    = 70
 gnue_scale     = 0
 gnue_comment   = Comment
+gnue_nullable  = 
 
+[gnue_property.gnue_nullable]
+gnue_id        = 00000000000000000000000000000039
+gnue_class     = 00000000000000000000000000000030
+gnue_module    = 00000000000000000000000000000000
+gnue_name      = nullable
+gnue_type      = boolean
+gnue_length    = 0
+gnue_scale     = 0
+gnue_comment   = Property can contain NULL values
+gnue_nullable  = 
 
+
 ; -----------------------------------------------------------------------------
 ; procedures
 ; -----------------------------------------------------------------------------
@@ -236,6 +262,7 @@
 gnue_length    = 0
 gnue_scale     = 0
 gnue_comment   = Object ID
+gnue_nullable  = FALSE
 
 [gnue_procedure.gnue_class]
 gnue_id        = 00000000000000000000000000000042
@@ -246,6 +273,7 @@
 gnue_length    = 0
 gnue_scale     = 0
 gnue_comment   = Class the procedure belongs to
+gnue_nullable  = FALSE
 
 [gnue_procedure.gnue_module]
 gnue_id        = 00000000000000000000000000000043
@@ -256,6 +284,7 @@
 gnue_length    = 0
 gnue_scale     = 0
 gnue_comment   = Module that defined this procedure
+gnue_nullable  = FALSE
 
 [gnue_procedure.gnue_name]
 gnue_id        = 00000000000000000000000000000044
@@ -266,6 +295,7 @@
 gnue_length    = 35
 gnue_scale     = 0
 gnue_comment   = Procedurename without modulename
+gnue_nullable  = 
 
 [gnue_procedure.gnue_language]
 gnue_id        = 00000000000000000000000000000045
@@ -276,6 +306,7 @@
 gnue_length    = 10
 gnue_scale     = 0
 gnue_comment   = Procedure language
+gnue_nullable  = 
 
 [gnue_procedure.gnue_code]
 gnue_id        = 00000000000000000000000000000046
@@ -286,6 +317,7 @@
 gnue_length    = 0
 gnue_scale     = 0
 gnue_comment   = Procedure code
+gnue_nullable  = 
 
 [gnue_procedure.gnue_compiledcode]
 gnue_id        = 00000000000000000000000000000047
@@ -296,6 +328,7 @@
 gnue_length    = 0
 gnue_scale     = 0
 gnue_comment   = Compiled procedure code
+gnue_nullable  = 
 
 [gnue_procedure.gnue_comment]
 gnue_id        = 00000000000000000000000000000048
@@ -306,4 +339,5 @@
 gnue_length    = 70
 gnue_scale     = 0
 gnue_comment   = Comment
+gnue_nullable  = 
 

Modified: trunk/gnue-appserver/src/geasGsdGen.py
===================================================================
--- trunk/gnue-appserver/src/geasGsdGen.py      2004-03-16 05:46:28 UTC (rev 
5328)
+++ trunk/gnue-appserver/src/geasGsdGen.py      2004-03-16 14:54:04 UTC (rev 
5329)
@@ -81,8 +81,9 @@
     try:
       sSupport.writeSchemaToFile (self.__filename, args, self.__type)
 
-    except Exception, msg:
-      sys.stderr.write (_("Error: %s\n") % msg)
+    except Exception:
+      msg = "%s\n" % str (sys.exc_info () [1])
+      sys.stderr.write (msg)
       sys.exit (1)
 
     self.__message (_("Generation run complete."))

Deleted: trunk/gnue-appserver/src/language/Exceptions.py
===================================================================
--- trunk/gnue-appserver/src/language/Exceptions.py     2004-03-16 05:46:28 UTC 
(rev 5328)
+++ trunk/gnue-appserver/src/language/Exceptions.py     2004-03-16 14:54:04 UTC 
(rev 5329)
@@ -1,62 +0,0 @@
-# GNU Enterprise Application Server - Language interface Exceptions
-#
-# Copyright 2003-2004 Free Software Foundation
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it 
-# and/or modify it under the terms of the GNU General Public 
-# License as published by the Free Software Foundation; either 
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be 
-# useful, but WITHOUT ANY WARRANTY; without even the implied 
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public 
-# License along with program; see the file COPYING. If not, 
-# write to the Free Software Foundation, Inc., 59 Temple Place 
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# $Id$
-
-
-# ===========================================================================
-# Base class for all language interface exceptions
-# ===========================================================================
-class ELanguageInterface (Exception):
-
-  def __init__ (self, text):
-    self.__text = text
-    Exception.__init__ (self, self.__text)
-
-  def __repr__ (self):
-    return self.__text
-
-
-# ---------------------------------------------------------------------------
-# General qualification error
-# ---------------------------------------------------------------------------
-class EQualificationError (ELanguageInterface):
-
-  def __init__ (self, text):
-    ELanguageInterface.__init__ (self, text)
-
-# ---------------------------------------------------------------------------
-# Qualification error: no context given
-# ---------------------------------------------------------------------------
-class ENoContext (EQualificationError):
-
-  def __init__ (self, name):
-    msg = _("Cannot qualifiy name '%s', no context specified.") % name
-    EQualificationError.__init__ (self, msg)
-
-# ---------------------------------------------------------------------------
-# EMemberNotFound: Business object has no such member
-# ---------------------------------------------------------------------------
-class EMemberNotFound (ELanguageInterface):
-  def __init__ (self, aClass, aMember):
-    ELanguageInterface.__init__ (self, 
-       _("Class '%(classname)s' has no member '%(member)s'") % 
-        {"classname": aClass, "member": aMember})

Modified: trunk/gnue-appserver/src/language/Object.py
===================================================================
--- trunk/gnue-appserver/src/language/Object.py 2004-03-16 05:46:28 UTC (rev 
5328)
+++ trunk/gnue-appserver/src/language/Object.py 2004-03-16 14:54:04 UTC (rev 
5329)
@@ -27,9 +27,20 @@
 import mx.DateTime.ISO
 
 from Procedure import Procedure
-from Exceptions import EMemberNotFound
 
+
 # ===========================================================================
+# Exceptions
+# ===========================================================================
+
+class MemberNotFoundError (Exception):
+  def __init__ (self, classname, member):
+    msg = _("Class '%(classname)s' has no member '%(member)s'") % \
+             {"classname": classname, "member": member}
+    Exception.__init__ (self, msg)
+
+
+# ===========================================================================
 # Helper methods
 # ===========================================================================
 
@@ -80,7 +91,7 @@
       return self.__rpc_to_native (value, datatype)
 
     else:
-      raise EMemberNotFound (self.__class, name)
+      raise MemberNotFoundError (self.__class, name)
 
 
   # -------------------------------------------------------------------------

Modified: trunk/gnue-appserver/src/language/ObjectList.py
===================================================================
--- trunk/gnue-appserver/src/language/ObjectList.py     2004-03-16 05:46:28 UTC 
(rev 5328)
+++ trunk/gnue-appserver/src/language/ObjectList.py     2004-03-16 14:54:04 UTC 
(rev 5329)
@@ -21,7 +21,7 @@
 #
 # $Id$
 
-import types
+from types import SliceType
 from Object import Object
 
 CACHE_STEP = 10
@@ -57,7 +57,7 @@
   # -------------------------------------------------------------------------
   def __getitem__ (self, index):
     try:
-      if type (index) == types.SliceType:
+      if type (index) == SliceType:
         return self.__list [index.start:index.stop]
       else:
         return self.__list [index]

Modified: trunk/gnue-appserver/src/language/Session.py
===================================================================
--- trunk/gnue-appserver/src/language/Session.py        2004-03-16 05:46:28 UTC 
(rev 5328)
+++ trunk/gnue-appserver/src/language/Session.py        2004-03-16 14:54:04 UTC 
(rev 5329)
@@ -23,10 +23,19 @@
 
 from ObjectList import ObjectList
 from Object import Object
-from Exceptions import ENoContext
 
 
 # ===========================================================================
+# Exceptions
+# ===========================================================================
+
+class NoContextError (Exception):
+  def __init__ (self, name):
+    msg = _("Cannot qualifiy name '%s', no context specified") % name
+    Exception.__init__ (self, name)
+
+
+# ===========================================================================
 # CLASS session: implement a session of the language interface
 # ===========================================================================
 class Session:
@@ -65,7 +74,7 @@
       return name
     else:
       if self.__context is None:
-        raise ENoContext (name)
+        raise NoContextError (name)
       else:
         return "%s_%s" % (self.__context, name)
 





reply via email to

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