Oh what a twisted thread we weave....
Tom Anderson
twic at urchin.earth.li
Sat Oct 29 08:46:55 EDT 2005
On Sat, 28 Oct 2005, GregM wrote:
> ST_zeroMatch = 'You found 0 products'
> ST_zeroMatch2 = 'There are no products matching your selection'
>
> # why does this always drop through even though the If should be true.
> if (ST_zeroMatch or ST_zeroMatch2) in self.webpg:
This code - i do not think it means what you think it means. Specifically,
it doesn't mean "is either of ST_zeroMatch or ST_zeroMatch2 in
self.webpg"; what it means is "apply the 'or' opereator to ST_zeroMatch
and ST_zeroMatch2, then check if the result is in self.webpg". The result
of applying the or operator to two nonempty strings is the left-hand
string; your code is thus equivalent to
if ST_zeroMatch in self.webpg:
Which will work in cases where your page says 'You found 0 products', but
not in cases where it says 'There are no products matching your
selection'.
What you want is:
if (ST_zeroMatch in self.webpg) or (ST_zeroMatch2 in self.webpg):
Or something like that.
You say that you have a single-threaded version of this that works;
presumably, you have a working version of this logic in there. Did you
write the threaded version from scratch? Often a bad move!
tom
--
It's the 21st century, man - we rue _minutes_. -- Benjamin Rosenbaum
More information about the Python-list
mailing list