Object.Get( name ) was throwing an AttributeError.

Change to throw more correct ValueError when name
is not found as per IRC discussion
This commit is contained in:
Stephen Swaney 2006-01-14 02:13:15 +00:00
parent c18db96f56
commit adcef46599

@ -730,9 +730,13 @@ PyObject *M_Object_Get( PyObject * self, PyObject * args )
object = GetObjectByName( name ); object = GetObjectByName( name );
/* No object exists with the name specified in the argument name. */ /* No object exists with the name specified in the argument name. */
if( !object ) if( !object ){
return EXPP_ReturnPyObjError( PyExc_AttributeError, char buffer[128];
"Unknown object specified." ); PyOS_snprintf( buffer, sizeof(buffer),
"object \"%s\" not found", name);
return EXPP_ReturnPyObjError( PyExc_ValueError,
buffer );
}
return Object_CreatePyObject( object ); return Object_CreatePyObject( object );
} else { } else {