[Zope] Squishdot Error on Zope 2.6.0

Chris Withers chrisw@nipltd.com
Mon, 28 Oct 2002 15:11:14 +0000


Jerome Alet wrote:
> On Mon, Oct 28, 2002 at 02:29:02PM +0000, Chris Withers wrote:
> 
>>Jens Vagelpohl wrote:
>>
>>>you're correct, ZCatalog has seen many changes. but instead of giving up 
>>>and hardcoding an expected environment just a couple more lines of code 
>>>can go a long way towards ameliorating the impact of those changes.
>>
>>I'm with Jerome on this one, go bait somewhere else...
> 
> 
> too bad I fundamentally agree with Jens here ;-)
> 
> theorically, what Jens says is better coding method.

Well, if you're both going to bait ;-)

So, today catalog has a searchResults method, in two years time that may change 
so that only __call__ is supported.

Does that mean I should write:

try:
    results = self.catalog.searchResults(...)
except AttributeError:
    print "catalog had no searchResults method!"
    results = []
?

...but then what if AttributeError isn't what gets raised?

So now I have to wrap every call in a bare try:.. except?
I'll leave you to go through the archives to find out why that is totally 
abhorent ;-)

The situation with catalog indexes is identical to this. When I wrote that code, 
it's what catalog did, there were no plans to change that and it didn't look 
like there ever would be (the current situation with searchResults now ;-).
So, now things have changed. I get a few bug reports and change the code. 
Ironicly, this will probably be to exactly the code you guys are talking about, 
to maintain backwards compatability.

But, I'm not gonna try and become psychic, and I wouldn't expect anyone else to, 
and I'm not gonna follow Jens suggested path which really does lead to writing 
an infinitely large piece of code at it's conclusion (what if the y['x'] syntax 
is deprecated in Python 10?) I'm also gonna stick to the old adage of KISS which 
also runs through XP, which has stood me in good stead and means I don't have to 
go crystal ball hunting (the magic ones are hard to find yaknow ;-)

cheers,

Chris