Revision: 966
http://svn.sourceforge.net/pygccxml/?rev=966&view=rev
Author: roman_yakovenko
Date: 2007-04-01 13:08:17 -0700 (Sun, 01 Apr 2007)
Log Message:
-----------
implementing custom exception support
Modified Paths:
--------------
pyplusplus_dev/docs/troubleshooting_guide/exceptions/exceptions.cpp
pyplusplus_dev/docs/troubleshooting_guide/exceptions/test.py
Modified: pyplusplus_dev/docs/troubleshooting_guide/exceptions/exceptions.cpp
===================================================================
--- pyplusplus_dev/docs/troubleshooting_guide/exceptions/exceptions.cpp 2007-03-31 18:27:37 UTC (rev 965)
+++ pyplusplus_dev/docs/troubleshooting_guide/exceptions/exceptions.cpp 2007-04-01 20:08:17 UTC (rev 966)
@@ -108,6 +108,7 @@
bpl::class_< application_error >( "_application_error_" )
.def( bpl::init<const std::string&>() )
.def( bpl::init<const application_error&>() )
+ .def( "application_name", &application_error::application_name)
.def( "message", &application_error::message, return_copy_const_ref() )
.def( "__str__", &application_error::message, return_copy_const_ref() );
Modified: pyplusplus_dev/docs/troubleshooting_guide/exceptions/test.py
===================================================================
--- pyplusplus_dev/docs/troubleshooting_guide/exceptions/test.py 2007-03-31 18:27:37 UTC (rev 965)
+++ pyplusplus_dev/docs/troubleshooting_guide/exceptions/test.py 2007-04-01 20:08:17 UTC (rev 966)
@@ -8,7 +8,14 @@
def __str__( self ):
return self._pimpl.message()
-
+
+ def __getattribute__(self, attr):
+ my_pimpl = super(application_error, self).__getattribute__("_pimpl")
+ try:
+ return getattr(my_pimpl, attr)
+ except AttributeError:
+ return super(application_error,self).__getattribute__(attr)
+
my_exceptions.application_error = application_error
class tester_t( unittest.TestCase ):
@@ -34,7 +41,7 @@
try:
my_exceptions.check_preconditions( True )
except Exception, err:
- self.failUnless( err.application_name() == "xyz" )
+ self.failUnless( err.application_name() == "my_exceptions module" )
def test_converter( self ):
try:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|