ServiceObject.IsValid() method

Ivan R. Judson judson at mcs.anl.gov
Sat Feb 8 16:35:19 CST 2003


Because validating a url connects to an object is a more direct solution
than handling an error on an enter call (oh, you can't enter *that*, that's
not a valid client proxy.

Fwiw, if the get_proxy() isn't validating that the url points to a real
object, there are some serious semantic ramifications -- that is you *never*
know if the client proxy is actually valid -- which seems fundamentally
wrong, doesn't it? If the url passed to Client().get_proxy() isn't valid
shouldn't it at least throw an exception? Or return None?

Look at bin\VenueClient.py -> GoToNewVenue(..args..), where this all started
from.

--Ivan

> -----Original Message-----
> From: Robert Olson [mailto:olson at mcs.anl.gov] 
> Sent: Saturday, February 08, 2003 2:56 PM
> To: judson at mcs.anl.gov; 'AG Dev'
> Subject: RE: ServiceObject.IsValid() method
> 
> 
> At 02:50 PM 2/8/2003 -0600, Ivan R. Judson wrote:
> 
> >Yeah, I don't expect this is one of those 'use it all the 
> time' things, 
> >but for example to verify that a venue url actually maps to 
> a venue the 
> >first time would make the code a lot less twisty and turny.
> 
> I don't see how it'd be less turny to call IsWhatever and 
> handle the error 
> case than to call the method you want and handle the exception.
> 
> >I can't think of any other cases, actually.
> >
> >--Ivan
> >
> > > -----Original Message-----
> > > From: Robert Olson [mailto:olson at mcs.anl.gov]
> > > Sent: Saturday, February 08, 2003 2:33 PM
> > > To: judson at mcs.anl.gov; 'AG Dev'
> > > Subject: RE: ServiceObject.IsValid() method
> > >
> > >
> > > Hm. The price you pay is an expensive roundtrip to verify if you 
> > > have the object you're looking for, rather than just handling the
> > > exception when you
> > > have it wrong.
> > >
> > > --bob
> > >
> > > At 01:55 PM 2/8/2003 -0600, Ivan R. Judson wrote:
> > >
> > > >I don't know. The behavior I'm trying to avoid is that a
> > > client object
> > > >(result of ...get_proxy() isn't really anything until a call
> > > is made,
> > > >but if that call fails your down the error handling path 
> -- you'd 
> > > >really like to know if the handle is valid ahead of time in some 
> > > >cases...
> > > >
> > > >Does that make it any more clear?  The words that come to
> > > mind are "you
> > > >want to know you have a valid proxy object before you use
> > > it", but I'm
> > > >not sure that helps make it more clear :-)
> > > >
> > > >--Ivan
> > > >
> > > > > -----Original Message-----
> > > > > From: Robert Olson [mailto:olson at mcs.anl.gov]
> > > > > Sent: Saturday, February 08, 2003 1:38 PM
> > > > > To: judson at mcs.anl.gov; 'AG Dev'
> > > > > Subject: Re: ServiceObject.IsValid() method
> > > > >
> > > > >
> > > > > is that doing the same thing as isinstance(obj, 
> ServiceObject) ?
> > > > >
> > > > > At 01:32 PM 2/8/2003 -0600, Ivan R. Judson wrote:
> > > > > >I propose we add amethod IsValid() to the service object
> > > > > that returns
> > > > > >true. Then you can verify that your handle is good *before*
> > > > > you try to
> > > > > >use it. This makes it significantly easier to handle cases
> > > > > like venue
> > > > > >entering...
> > > > > >
> > > > > >Thoughts?
> > > > >
> > >
> 




More information about the ag-dev mailing list