[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r5821 - in trunk: gnue-appserver gnue-appserver/doc/technotes gnue-appse
From: |
johannes |
Subject: |
r5821 - in trunk: gnue-appserver gnue-appserver/doc/technotes gnue-appserver/src gnue-appserver/src/classrep gnue-appserver/src/language gnue-common/src/logic gnue-common/src/logic/adapters gnue-common/src/rpc |
Date: |
Fri, 21 May 2004 03:04:54 -0500 (CDT) |
Author: johannes
Date: 2004-05-21 03:04:52 -0500 (Fri, 21 May 2004)
New Revision: 5821
Added:
trunk/gnue-appserver/doc/technotes/00003.txt
Modified:
trunk/gnue-appserver/BUGS
trunk/gnue-appserver/src/__init__.py
trunk/gnue-appserver/src/classrep/Base.py
trunk/gnue-appserver/src/classrep/Namespace.py
trunk/gnue-appserver/src/classrep/Parameter.py
trunk/gnue-appserver/src/classrep/SchemaSupport.py
trunk/gnue-appserver/src/classrep/__init__.py
trunk/gnue-appserver/src/classrep/helpers.py
trunk/gnue-appserver/src/geasAuthentication.py
trunk/gnue-appserver/src/geasInstance.py
trunk/gnue-appserver/src/geasSession.py
trunk/gnue-appserver/src/geasSessionManager.py
trunk/gnue-appserver/src/language/Object.py
trunk/gnue-appserver/src/language/Session.py
trunk/gnue-common/src/logic/adapters/Base.py
trunk/gnue-common/src/logic/language.py
trunk/gnue-common/src/rpc/client.py
Log:
Revised exceptions and exception handling, added a technote describing all
exceptions.
Modified: trunk/gnue-appserver/BUGS
===================================================================
--- trunk/gnue-appserver/BUGS 2004-05-19 16:57:24 UTC (rev 5820)
+++ trunk/gnue-appserver/BUGS 2004-05-21 08:04:52 UTC (rev 5821)
@@ -3,7 +3,5 @@
* Time fields are broken in some dbdrivers. Depending on the driver, it's
possible that the "Meeting Time" field in the sample doesn't work.
-* Exception handling could be improved
-
* Operations on the Session Manager interface are not atomar
Added: trunk/gnue-appserver/doc/technotes/00003.txt
===================================================================
--- trunk/gnue-appserver/doc/technotes/00003.txt 2004-05-19 16:57:24 UTC
(rev 5820)
+++ trunk/gnue-appserver/doc/technotes/00003.txt 2004-05-21 08:04:52 UTC
(rev 5821)
@@ -0,0 +1,483 @@
+Title: Overview of the exceptions in the Application Server
+Status: Current
+Created: 2004-05-21
+Revised: 2004-05-21
+
+
+This document describes all exceptions defined and raised by the application
+server.
+
+
+Definitiontree of the application server exceptions:
+----------------------------------------------------
+
+appserver
+ |
+ +-- classrep
+ | +-- Base
+ | | +-- ClassRepositoryError
+ | | | +-- ItemNotFoundError
+ | | +-- ItemValidationError (helpers.ValidationError)
+ | |
+ | +-- Class
+ | | +-- ClassNotFoundError (Base.ClassRepositoryError)
+ | |
+ | +-- Definition
+ | | +-- InvalidDefinitionError (Base.ClassRepositoryError)
+ | |
+ | +-- helpers
+ | | +-- ValidationError (appserver.Error)
+ | | +-- TypeNameError
+ | | +-- TypeFormatError
+ | | +-- ParameterValidationError
+ | |
+ | +-- Module
+ | | +-- ModuleNotFoundError (Base.ClassRepositoryError)
+ | |
+ | +-- Namespace
+ | | +-- InvalidNameError (Base.ClassRepositoryError)
+ | |
+ | +-- Parameter
+ | | +-- ParameterNotFoundError (Base.ClassRepositoryError)
+ | |
+ | +-- Procedure
+ | | +-- ProcedureNotFoundError (Base.ClassRepositoryError)
+ | | +-- ProcedureValidationError (helpers.ValidationError)
+ | |
+ | +-- Property
+ | | +-- PropertyNotFoundError (Base.ClassRepositoryError)
+ | | +-- PropertyValidationError (helpers.ValidationError)
+ | |
+ | +-- SchemaSupport
+ | +-- SchemaSupportError (appserver.Error)
+ | +-- ExportTypeError
+ | +-- ValueError
+ |
+ +-- geasAuthentication
+ | +-- AuthError (appserver.Error)
+ |
+ +-- geasInstance
+ | +-- DbValueError (appserver.Error)
+ | +-- ParameterValueError (appserver.Error)
+ | +-- PropertyAccessError (appserver.Error)
+ | +-- PropertyValueError (appserver.Error)
+ | +-- ResultTypeError (appserver.Error)
+ |
+ +-- geasSession
+ | +-- AccessDeniedError (geasAuthentication.AuthError)
+ | +-- InstanceNotFoundError (appserver.Error)
+ | +-- ListNotFoundError (appserver.Error)
+ |
+ +-- geasSessionManager
+ | +-- SessionNotFoundError (appserver.Error)
+ |
+ +-- language
+ +--Session
+ | +-- NoContextError (appserver.Error)
+ |
+ +--Object
+ +-- MemberNotFoundError (appserver.Error)
+
+
+
+List of exception-occurence on a per function basis:
+----------------------------------------------------
+
+File: classrep/__init__.py
+--------------------------
+
+ init ():
+ from classrep.Definition.__init__ ():
+ Base.ClassRepositoryError
+ InvalidDefinitionError
+
+ from langauge.session.find ():
+ geasSession.AccessDeniedError
+ geasSession.ReferenceError
+ geasSession.ListNotFoundError
+ geasInstance.ReferenceError
+
+
+File: classrep/helpers.py
+-------------------------
+
+ verifyBasetype ():
+ TypeNameError
+ TypeFormatError
+
+ verifyReference ():
+ TypeFormatError
+
+ verifyType ():
+ from helpers.verifyReference / verifyBasetype ():
+ TypeFormatError
+ from helpers.verifyBasetype ():
+ TypeNameError
+
+ verifyProcedure ():
+ TypeFormatError
+ ParameterValidationError
+ from helpers.verifyBasetype ():
+ TypeNameError
+
+
+File: classrep/Base.py
+----------------------
+
+ BaseDictionary._getSingleCondition ():
+ ClassRepositoryError
+
+ BaseDictionary._getNewItem ():
+ ClassRepositoryError
+
+ BaseDictionary.__getitem__ ():
+ raises result of the method 'self._validationError'
+ raises result of the method 'self._itemNotFoundError'
+
+
+File: classrep/Class.py
+-----------------------
+
+ ClassDict.__getitem__ ():
+ ClassNotFoundError
+ Base.ItemValidationError
+
+
+File: classrep/Definition.py
+----------------------------
+
+ RepositoryDefinition.__init__ ():
+ Base.ClassRepositoryError
+ InvalidDefinitionError
+
+
+File: classrep/Module.py
+------------------------
+
+ ModuleDict.__getitem__ ():
+ ModuleNotFoundError
+ Base.ItemValidationError
+
+
+File: classrep/Namespace.py
+---------------------------
+
+ splitName ():
+ InvalidNameError
+
+
+File: classrep/Parameter.py
+---------------------------
+
+ ParameterDict.__getitem__ ():
+ ParameterNotFoundError
+ Base.ItemValidationError
+
+
+File: classrep/Procedure.py
+---------------------------
+
+ ProcedureDict.__getitem__ ():
+ ProcedureNotFoundError
+ ProcedureValidationError
+
+
+File: classrep/Property.py
+--------------------------
+
+ PropertyDict.__getitem__ ():
+ PropertyNotFoundError
+ PropertyValidationError
+
+
+File: classrep/SchemaSupport.py
+-------------------------------
+
+ writeSchemaToFile ():
+ ExportTypeError
+ ValueError
+ Namespace.InvalidNameError
+
+
+
+File: geasAuthentication.py
+---------------------------
+
+ authenticate ():
+ AuthError
+
+
+File: geasInstance.py
+---------------------
+
+ get (), __getitem__ ():
+ ReferenceError
+
+
+ put ():
+ PropertyAccessError
+ PropertyValueError
+
+
+ call ():
+ ResultTypeError
+ ReferenceError
+
+ from classrep.Parameter.__getitem__ ():
+ classrep.Parameter.ParameterNotFoundError
+ classrep.Base.ItemValidationError
+
+ from gnue.common.logic.language.getLanguageAdapter ():
+ gnue.common.logic.language.AdapterNotFoundError
+ gnue.common.logic.language.adapters.Base.ImplementationError
+
+ from gnue.common.logic.language.adapters.???.bindObject/Function:
+ gnue.common.logic.language.adapters.Base.ImplementationError
+
+ gnue.common.logic.language.CompileError
+ gnue.common.logic.language.RuntimeError
+
+
+ validate ():
+ PropertyValueError
+
+
+File: geasList.py
+-----------------
+
+ fetch ():
+ from geasInstance.get ():
+ geasInstance.ReferenceError
+
+
+ count ():
+ from geasInstance.get ():
+ geasInstance.ReferenceError
+
+
+File: geasSession.py
+--------------------
+
+ login ():
+ from geasAuthentication.geasAuthAgent.authenticate ():
+ geasAuthentication.AuthError
+
+
+ commit ():
+ from geasInstance.validate ():
+ geasInstance.PropertyValueError
+
+
+ request ():
+ AccessDeniedError
+ ReferenceError
+
+
+ count ():
+ ListNotFoundError
+ from geasList.count ():
+ geasInstance.ReferenceError
+
+
+ fetch ():
+ ListNotFoundError
+ from geasList.fetch ():
+ geasInstance.ReferenceError
+
+
+ load ():
+ AccessDeniedError
+ InstanceNotFoundError
+ from geasInstance.get ():
+ geasInstance.ReferenceError
+ from classrep.Class.__getitem__ ():
+ classrep.Property.PropertyNotFoundError
+
+
+ store ():
+ AccessDeniedError
+ InstanceNotFoundError
+ from geasInstance.put ():
+ geasInstance.PropertyAccessError
+ geasInstance.PropertyValueError
+ from classrep.Class.__getitem__ ():
+ classrep.Property.PropertyNotFoundError
+
+
+ delete ():
+ AccessDeniedError
+
+
+ call ():
+ AccessDeniedError
+ InstanceNotFoundError
+
+ from classrep.Class.__getitem__ ():
+ classrep.Property.PropertyNotFoundError
+
+ from geasInstance.call ():
+ geasInstance.ResultTypeError
+ geasInstance.ReferenceError
+ classrep.Parameter.ParameterNotFoundError
+ classrep.Base.ItemValidationError
+ gnue.common.logic.language.AdapterNotFoundError
+ gnue.common.logic.language.adapters.Base.ImplementationError
+ gnue.common.logic.language.adapters.Base.ImplementationError
+ gnue.common.logic.language.CompileError
+ gnue.common.logic.language.RuntimeError
+
+
+File: geasSessionManager.py
+---------------------------
+
+ open ():
+ from geasSession.login ():
+ geasAuthentication.AuthError
+
+
+ close ():
+ SessionNotFoundError
+ from geasSession.commit ():
+ geasInstance.PropertyValueError
+
+
+ commit ():
+ SessionNotFoundError
+ from geasSession.commit ():
+ geasInstance.PropertyValueError
+
+
+ request ():
+ SessionNotFoundError
+ from geasSession.request ():
+ geasSession.AccessDeniedError
+ geasSession.ReferenceError
+
+
+ rollback ():
+ SessionNotFoundError
+
+
+ count ():
+ SessionNotFoundError
+ from geasSession.count ():
+ geasSession.ListNotFoundError
+ geasInstance.ReferenceError
+
+
+ fetch ():
+ SessionNotFoundError
+ from geasSession.fetch ():
+ geasSession.ListNotFoundError
+ geasInstance.ReferenceError
+
+
+ load ():
+ SessionNotFoundError
+ from geasSession.load ():
+ geasSession.AccessDeniedError
+ geasSession.InstanceNotFoundError
+ geasInstance.ReferenceError
+ classrep.Property.PropertyNotFoundError
+
+
+ store ():
+ SessionNotFoundError
+ from geasSession.store ():
+ geasSession.AccessDeniedError
+ geasSession.InstanceNotFoundError
+ geasInstance.PropertyAccessError
+ geasInstance.PropertyValueError
+ classrep.Property.PropertyNotFoundError
+
+
+ delete ():
+ SessionNotFoundError
+ from geasSession.delete ():
+ geasSession.AccessDeniedError
+
+
+ call ():
+ SessionNotFoundError
+ from geasSession.call ():
+ geasSession.AccessDeniedError
+ geasSession.InstanceNotFoundError
+ classrep.Property.PropertyNotFoundError
+ geasInstance.ResultTypeError
+ geasInstance.ReferenceError
+ classrep.Parameter.ParameterNotFoundError
+ classrep.Base.ItemValidationError
+ gnue.common.logic.language.AdapterNotFoundError
+ gnue.common.logic.language.adapters.Base.ImplementationError
+ gnue.common.logic.language.adapters.Base.ImplementationError
+ gnue.common.logic.language.CompileError
+ gnue.common.logic.language.RuntimeError
+
+
+
+File: langauge/Session.py
+-------------------------
+
+ qualify ():
+ NoContextError
+
+ close ():
+ from geasSessionManager.close ():
+ geasInstance.PropertyValueError
+
+ commit ():
+ from geasSessionManager.commit ():
+ geasInstance.PropertyValueError
+
+ find ():
+ from language.ObjectList.__init__ ():
+ geasSession.AccessDeniedError
+ geasInstance.ReferenceError
+ geasSession.ListNotFoundError
+ geasInstance.ReferenceError
+
+ new ():
+ from language.Object.__init__ ():
+ geasSession.AccessDeniedError
+ geasSession.InstanceNotFoundError
+
+
+File: language/ObjectList.py
+----------------------------
+
+ __init__ ():
+ from geasSessionManager.request ():
+ geasSession.AccessDeniedError
+ geasSession.ReferenceError
+
+ from geasSessionManager.fetch ():
+ geasSession.ListNotFoundError
+ geasInstance.ReferenceError
+
+
+ __getitem__ ()
+ IndexError
+
+
+File: language/Object.py
+------------------------
+
+ __init__ ():
+ from geasSessionManager.store ():
+ geasSession.AccessDeniedError
+ geasSession.InstanceNotFoundError
+
+ __getitem__ (), __getattr__ ():
+ MemberNotFoundError
+ from language.Session.qualify ():
+ Session.NoContextError
+
+ __setitem__ (), __setattr__ ():
+ AttributeError
+ from language.Session.qualify ():
+ Session.NoContextError
+
+ delete ():
+ from geasSessionManager.delete ():
+ geasSession.AccessDeniedError
+
Modified: trunk/gnue-appserver/src/__init__.py
===================================================================
--- trunk/gnue-appserver/src/__init__.py 2004-05-19 16:57:24 UTC (rev
5820)
+++ trunk/gnue-appserver/src/__init__.py 2004-05-21 08:04:52 UTC (rev
5821)
@@ -19,8 +19,9 @@
# Copyright 2001-2004 Free Software Foundation
#
+class Error (gException):
+ pass
-
#
# CREATING A RELEASE:
# 1. Change _version to be the current version number
Modified: trunk/gnue-appserver/src/classrep/Base.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Base.py 2004-05-19 16:57:24 UTC (rev
5820)
+++ trunk/gnue-appserver/src/classrep/Base.py 2004-05-21 08:04:52 UTC (rev
5821)
@@ -23,26 +23,22 @@
import types
import helpers
+from gnue import appserver
from gnue.appserver.language.Object import Object
# =============================================================================
# Exceptions
# =============================================================================
-class ClassRepositoryError (gException):
- """
- This Exception is the base class for all repository exceptions
- """
- def __init__ (self, text):
- gException.__init__ (self, text)
+class ClassRepositoryError (appserver.Error):
+ pass
-
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)
+ ClassRepositoryError.__init__ (self, u_("Item '%s' not found.") % key)
class ItemValidationError (helpers.ValidationError):
@@ -97,7 +93,7 @@
objectlist. If an object is new in the list, use _getNewItem () to build a
new instance for the object.
"""
- for obj in addList:
+ for obj in addList:
found = 0
for item in self._items.values ():
Modified: trunk/gnue-appserver/src/classrep/Namespace.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Namespace.py 2004-05-19 16:57:24 UTC
(rev 5820)
+++ trunk/gnue-appserver/src/classrep/Namespace.py 2004-05-21 08:04:52 UTC
(rev 5821)
@@ -30,7 +30,7 @@
class InvalidNameError (ClassRepositoryError):
def __init__ (self, name):
- msg = _("'%s' is not a valid, fully qualified identifier.") % name
+ msg = u_("'%s' is not a valid, fully qualified identifier") % name
ClassRepositoryError.__init__ (self, msg)
Property changes on: trunk/gnue-appserver/src/classrep/Parameter.py
___________________________________________________________________
Name: svn:keywords
- svn:Id
+ +Id
Modified: trunk/gnue-appserver/src/classrep/SchemaSupport.py
===================================================================
--- trunk/gnue-appserver/src/classrep/SchemaSupport.py 2004-05-19 16:57:24 UTC
(rev 5820)
+++ trunk/gnue-appserver/src/classrep/SchemaSupport.py 2004-05-21 08:04:52 UTC
(rev 5821)
@@ -24,6 +24,7 @@
import types
import mx.DateTime.ISO
+from gnue import appserver
from gnue.common.schema import Objects
from gnue.common.definitions import GParserHelpers
from gnue.appserver.classrep import Namespace
@@ -36,7 +37,7 @@
# Base exception
# -----------------------------------------------------------------------------
-class SchemaSupportError (gException):
+class SchemaSupportError (appserver.Error):
pass
# -----------------------------------------------------------------------------
@@ -45,7 +46,7 @@
class ExportTypeError (SchemaSupportError):
def __init__ (self, exportType):
- msg = _("Invalid export type: '%s'") % exportType
+ msg = u_("Invalid export type: '%s'") % exportType
SchemaSupportError.__init__ (self, msg)
# -----------------------------------------------------------------------------
@@ -421,7 +422,7 @@
return native.date
else:
- raise ValueError (_("%s is not a valid date object") % repr (native))
+ raise ValueError (u_("%s is not a valid date object") % repr (native))
elif datatype == "time":
@@ -432,7 +433,7 @@
return str (native)
else:
- raise ValueError (_("%s is not a valid time object") % repr (native))
+ raise ValueError (u_("%s is not a valid time object") % repr (native))
elif datatype == "datetime":
@@ -440,7 +441,7 @@
return str (native)
else:
- raise ValueError (_("%s is not a valid datetime object") % \
+ raise ValueError (u_("%s is not a valid datetime object") % \
repr (native))
else:
Modified: trunk/gnue-appserver/src/classrep/__init__.py
===================================================================
--- trunk/gnue-appserver/src/classrep/__init__.py 2004-05-19 16:57:24 UTC
(rev 5820)
+++ trunk/gnue-appserver/src/classrep/__init__.py 2004-05-21 08:04:52 UTC
(rev 5821)
@@ -28,8 +28,12 @@
from Namespace import *
from Definition import *
from gnue import paths
+from gnue import appserver
from gnue.appserver.language import Session
+class Error (appserver.Error):
+ pass
+
# -----------------------------------------------------------------------------
# Global module and class list
# -----------------------------------------------------------------------------
Modified: trunk/gnue-appserver/src/classrep/helpers.py
===================================================================
--- trunk/gnue-appserver/src/classrep/helpers.py 2004-05-19 16:57:24 UTC
(rev 5820)
+++ trunk/gnue-appserver/src/classrep/helpers.py 2004-05-21 08:04:52 UTC
(rev 5821)
@@ -20,7 +20,7 @@
#
# $Id: $
-import gnue
+from gnue import appserver
BASE_TYPES = ['boolean', 'date', 'datetime', 'id', 'number', 'string', 'time']
@@ -29,13 +29,13 @@
# Exceptions
# =============================================================================
-class ValidationError (gException):
+class ValidationError (appserver.Error):
pass
class TypeNameError (ValidationError):
def __init__ (self, typename):
- msg = u_("'%s' is not a valid type.") % typename
- gException.__init__ (self, msg)
+ msg = u_("'%s' is not a valid type") % typename
+ ValidationError.__init__ (self, msg)
class TypeFormatError (ValidationError):
pass
Property changes on: trunk/gnue-appserver/src/classrep/helpers.py
___________________________________________________________________
Name: svn:keywords
- svn:Id
+ +Id
Modified: trunk/gnue-appserver/src/geasAuthentication.py
===================================================================
--- trunk/gnue-appserver/src/geasAuthentication.py 2004-05-19 16:57:24 UTC
(rev 5820)
+++ trunk/gnue-appserver/src/geasAuthentication.py 2004-05-21 08:04:52 UTC
(rev 5821)
@@ -22,12 +22,13 @@
# $Id$
import string
+from gnue import appserver
# =============================================================================
# Exceptions
# =============================================================================
-class AuthError (gException):
+class AuthError (appserver.Error):
pass
# =============================================================================
Modified: trunk/gnue-appserver/src/geasInstance.py
===================================================================
--- trunk/gnue-appserver/src/geasInstance.py 2004-05-19 16:57:24 UTC (rev
5820)
+++ trunk/gnue-appserver/src/geasInstance.py 2004-05-21 08:04:52 UTC (rev
5821)
@@ -25,6 +25,7 @@
import string
import mx.DateTime
import mx.DateTime.ISO
+from gnue import appserver
from gnue.appserver.language import Object, Session
from gnue.common.logic.language import getLanguageAdapter
from gnue.appserver.classrep import Namespace
@@ -33,43 +34,51 @@
# Exceptions
# =============================================================================
-class DbValueError (gException):
+class DbValueError (appserver.Error):
def __init__ (self, propertyName, value):
message = u_("Database returned invalid value '%(value)s' for property "
"'%(property)s'") \
% {"value" : repr (value),
"property": propertyName}
- gException.__init__ (self, message)
+ appserver.Error.__init__ (self, message)
-class PropertyValueError (gException):
+class PropertyValueError (appserver.Error):
def __init__ (self, propertyName, value):
message = u_("Invalid value '%(value)s' for property '%(property)s'") \
% {"value": repr (value),
"property": propertyName}
- gException.__init__ (self, message)
+ appserver.Error.__init__ (self, message)
-class ParameterValueError (gException):
+class ParameterValueError (appserver.Error):
def __init__ (self, parameterName, value):
message = u_("Invalid value '%(value)s' for parameter '%(parameter)s'") \
% {"value" : repr (value),
"parameter": parameterName}
- gException.__init__ (self, message)
+ appserver.Error.__init__ (self, message)
-class ResultTypeError (gException):
+class ResultTypeError (appserver.Error):
def __init__ (self, procedure, typename, result):
msg = u_("Procedure '%(procedure)s' expected a result of type "
"'%(type)s', but got type '%(resulttype)s'") \
% {"procedure" : procedure,
"type" : typename,
"resulttype": type (result).__name__}
- gException.__init__ (self, msg)
+ appserver.Error.__init__ (self, msg)
-class PropertyAccessError (gException):
+class PropertyAccessError (appserver.Error):
def __init__ (self, classname, propertyname):
msg = u_("Calculated field '%(property)s' is a read-only field") \
% {"property": "%s.%s" % (classname, propertyname)}
- gException.__init__ (self, msg)
+ appserver.Error.__init__ (self, msg)
+class ReferenceError (appserver.Error):
+ def __init__ (self, name, part):
+ msg = u_("Cannot resolve propertyname '%(name)s' because '%(part)s' is "
+ "not a reference property") \
+ % {'name': name,
+ 'part': part}
+ appserver.Error.__init__ (self, msg)
+
# =============================================================================
# Instance class
# =============================================================================
@@ -191,10 +200,7 @@
for e in elements [:-1]:
propertydef = classdef.properties [e]
if not propertydef.isReference:
- raise gException, u_("Cannot resolve property name '%(name)s' because "
- "'%(part)s' is not a reference property") \
- % {'name': propertyname,
- 'part': propertydef.fullName}
+ raise ReferenceError, (propertyname, propertydef.fullName)
classdef = propertydef.referencedClass
key = record.getField (propertydef.column)
# if any reference on the way through the property name is None, assume
Modified: trunk/gnue-appserver/src/geasSession.py
===================================================================
--- trunk/gnue-appserver/src/geasSession.py 2004-05-19 16:57:24 UTC (rev
5820)
+++ trunk/gnue-appserver/src/geasSession.py 2004-05-21 08:04:52 UTC (rev
5821)
@@ -26,29 +26,33 @@
import string
import whrandom
+from gnue import appserver
from gnue.appserver import data
+from gnue.appserver.geasAuthentication import AuthError
import geasList, geasInstance
from gnue.common.datasources import GConditions
from mx import DateTime
-class InstanceNotFoundError (gException):
+class InstanceNotFoundError (appserver.Error):
def __init__ (self, classname, objectId):
msg = u_("Instance '%(objectId)s' of class '%(classname)s' not found") \
% {'objectId' : objectId,
'classname': classname }
- gException.__init__ (self, msg)
+ appserver.Error.__init__ (self, msg)
-class ReferenceError (gException):
- def __init__ (self, name, part):
- msg = u_("Cannot resolve property name '%(name)s' because "
- "'%(part)s' is not a reference property") \
- % {'name': name,
- 'part': part}
- gException.__init__ (self, msg)
+class AccessDeniedError (AuthError):
+ def __init__ (self, classname):
+ msg = u_("Access to class '%s' denied") % classname
+ AuthError.__init__ (self, msg)
+class ListNotFoundError (appserver.Error):
+ def __init__ (self, listId):
+ msg = u_ ("Cannot find a list with ID '%s'") % listId
+ appserver.Error.__init__ (self, msg)
+
# =============================================================================
# Session class
# =============================================================================
@@ -86,10 +90,12 @@
# check if user has access rights for this class
if not self.__authAdapter.hasAccess (self, self.__user, classname):
- raise gException, u_("Access to class '%s' denied") % classname
+ raise AccessDeniedError, (classname)
return self.sm.classes [classname]
+
+
def __getProcdef (self, classdef, procedurename):
# add access control to procedures here
return classdef.procedures [procedurename]
@@ -108,7 +114,7 @@
for e in elements [:-1]:
p = c.properties [e]
if not p.isReference:
- raise ReferenceError, (propertyname, p.fullName)
+ raise geasInstance.ReferenceError, (propertyname, p.fullName)
c = p.referencedClass
# do we already have a link?
found = False
@@ -254,7 +260,7 @@
if self.__lists.has_key (list_id):
return self.__lists [list_id]
else:
- raise gException, u_("Can't find a list with ID '%s'") % list_id
+ raise ListNotFoundError, (list_id)
# ---------------------------------------------------------------------------
# Count the number of objects in the list
@@ -495,7 +501,7 @@
for prop in parts [:-1]:
pDef = cDef.properties [prop]
if not pDef.isReference:
- raise ReferenceError, (propertyname, prop)
+ raise geasInstance.ReferenceError, (propertyname, prop)
cDef = pDef.referencedClass
return cDef.properties [parts [-1]]
Modified: trunk/gnue-appserver/src/geasSessionManager.py
===================================================================
--- trunk/gnue-appserver/src/geasSessionManager.py 2004-05-19 16:57:24 UTC
(rev 5820)
+++ trunk/gnue-appserver/src/geasSessionManager.py 2004-05-21 08:04:52 UTC
(rev 5821)
@@ -27,9 +27,19 @@
import geasAuthentication
import classrep
+from gnue import appserver
from gnue.common.datasources import GConnections
# =============================================================================
+# Exceptions
+# =============================================================================
+
+class SessionNotFoundError (appserver.Error):
+ def __init__ (self, sessionId):
+ msg = u_("Cannot find a session with ID '%s'") % sessionId
+ appserver.Error.__init__ (self, msg)
+
+# =============================================================================
# Session Manager class
# =============================================================================
@@ -68,7 +78,7 @@
if self._sessions.has_key (sess_id):
return self._sessions [sess_id]
else:
- raise gException, u_("Can't find a session with ID '%s'") % sess_id
+ raise SessionNotFoundError, (sess_id)
# ===========================================================================
# official API functions
Modified: trunk/gnue-appserver/src/language/Object.py
===================================================================
--- trunk/gnue-appserver/src/language/Object.py 2004-05-19 16:57:24 UTC (rev
5820)
+++ trunk/gnue-appserver/src/language/Object.py 2004-05-21 08:04:52 UTC (rev
5821)
@@ -24,17 +24,18 @@
import string
from Procedure import Procedure
+from gnue import appserver
# ===========================================================================
# Exceptions
# ===========================================================================
-class MemberNotFoundError (gException):
+class MemberNotFoundError (appserver.Error):
def __init__ (self, classname, member):
msg = u_("Class '%(classname)s' has no member '%(member)s'") % \
{"classname": classname, "member": member}
- gException.__init__ (self, msg)
+ appserver.Error.__init__ (self, msg)
# ===========================================================================
@@ -168,3 +169,4 @@
self.__session.getSessionManager ().delete (
self.__session.getSessionId (), self.__class, [self.objectId])
self.objectId = None
+
Modified: trunk/gnue-appserver/src/language/Session.py
===================================================================
--- trunk/gnue-appserver/src/language/Session.py 2004-05-19 16:57:24 UTC
(rev 5820)
+++ trunk/gnue-appserver/src/language/Session.py 2004-05-21 08:04:52 UTC
(rev 5821)
@@ -23,16 +23,17 @@
from ObjectList import ObjectList
from Object import Object
+from gnue import appserver
# ===========================================================================
# Exceptions
# ===========================================================================
-class NoContextError (gException):
+class NoContextError (appserver.Error):
def __init__ (self, name):
msg = u_("Cannot qualifiy name '%s', no context specified") % name
- gException.__init__ (self, name)
+ appserver.Error.__init__ (self, msg)
# ===========================================================================
@@ -140,3 +141,4 @@
# -------------------------------------------------------------------------
def __init__ (self, sessionManager):
Session.__init__ (self, sessionManager, 0)
+
Modified: trunk/gnue-common/src/logic/adapters/Base.py
===================================================================
--- trunk/gnue-common/src/logic/adapters/Base.py 2004-05-19 16:57:24 UTC
(rev 5820)
+++ trunk/gnue-common/src/logic/adapters/Base.py 2004-05-21 08:04:52 UTC
(rev 5821)
@@ -18,7 +18,7 @@
#
# Copyright 2001-2004 Free Software Foundation
#
-# $Id: $
+# $Id$
import sys
import traceback
@@ -165,8 +165,8 @@
def requestAbort (self, message):
"""
- Abstract: Generate a user abort request. Linked into the execution
namespace
- so that scripts can request an abort.
+ Abstract: Generate a user abort request. Linked into the execution
+ namespace so that scripts can request an abort.
"""
raise AbortRequest(message)
Modified: trunk/gnue-common/src/logic/language.py
===================================================================
--- trunk/gnue-common/src/logic/language.py 2004-05-19 16:57:24 UTC (rev
5820)
+++ trunk/gnue-common/src/logic/language.py 2004-05-21 08:04:52 UTC (rev
5821)
@@ -20,6 +20,7 @@
#
# $Id$
+import string
from gnue.common.utils.FileUtils import dyn_import
adapters = {}
@@ -29,22 +30,30 @@
# Exceptions
# =============================================================================
+# ---------------------------------------------------------------------------
+# The basis of all language errors
+# ---------------------------------------------------------------------------
+class Error (gException):
+ pass
+
# -----------------------------------------------------------------------------
# Python module not available
# -----------------------------------------------------------------------------
-class AdapterNotFoundError (gException):
+
+class AdapterNotFoundError (Error):
"""
The language adapter for the requested language cannot be imported.
"""
def __init__ (self, language):
msg = u_("No adapter available for language '%s'") % language
- gException.__init__ (self, msg)
+ Error.__init__ (self, msg)
# -----------------------------------------------------------------------------
# Abstract method not implemented
# -----------------------------------------------------------------------------
-class ImplementationError (gException):
+
+class ImplementationError (Error):
"""
Exception raised if an abstract method isn't implemented by a descendant.
"""
@@ -52,18 +61,51 @@
msg = u_("The class '%(class)s' has no implementation for '%(method)s'") \
% {"class" : classname,
"method": method}
- gException.__init__ (self, msg)
+ Error.__init__ (self, msg)
# -----------------------------------------------------------------------------
-# Virtual code exceptions
+# Code failed on compilation
# -----------------------------------------------------------------------------
-class CompileError (gException):
- pass
-class RuntimeError (gException):
+class CompileError (Error):
pass
-class AbortRequest (gException):
+# -----------------------------------------------------------------------------
+# Code failed on execution
+# -----------------------------------------------------------------------------
+
+class RuntimeError (Error):
+ """
+ Indicates an exception that happend on execution of a method/function.
+
+ If e is an exception of this type, then e.message is the message text of the
+ exception that occured, e.type is a string containing the name of the type of
+ the exception, and e.detail is the complete traceback.
+ """
+ def __init__ (self, traceback):
+ self.detail = traceback
+ self.type = ''
+ message = ''
+
+ print "TYPE:", type (traceback), "====", repr (self.detail)
+
+ # Search for start of Exception type/value part
+ list = string.split (traceback, '\n')
+ for i in range (1, len (list) - 1):
+ if len (list [i]) > 0 and list [i] [0] != ' ':
+ info = string.split (list [i], ': ', 1)
+ if len (info) == 2:
+ self.type = info [0]
+ message = string.join ([info [1]] + list [i+1:], '\n')
+ break
+ Error.__init__ (self, message)
+
+
+# -----------------------------------------------------------------------------
+# Abort the current execution
+# -----------------------------------------------------------------------------
+
+class AbortRequest (Error):
pass
# -----------------------------------------------------------------------------
@@ -107,6 +149,7 @@
code = """
print "Hello World!"
print "My name is %s." % name
+print fuck
return value * 2
"""
Modified: trunk/gnue-common/src/rpc/client.py
===================================================================
--- trunk/gnue-common/src/rpc/client.py 2004-05-19 16:57:24 UTC (rev 5820)
+++ trunk/gnue-common/src/rpc/client.py 2004-05-21 08:04:52 UTC (rev 5821)
@@ -114,7 +114,6 @@
# Search for start of Exception type/value part
list = string.split (traceback, '\n')
- print list
for i in range (1, len (list) - 1):
if len (list [i]) > 0 and list [i] [0] != ' ':
info = string.split (list [i], ': ', 1)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r5821 - in trunk: gnue-appserver gnue-appserver/doc/technotes gnue-appserver/src gnue-appserver/src/classrep gnue-appserver/src/language gnue-common/src/logic gnue-common/src/logic/adapters gnue-common/src/rpc,
johannes <=