At 07:19 AM 7/11/2001 -0700, Mike Orr wrote:
>On Wed, Jul 11, 2001 at 03:36:30PM +0200, Gilles Poidevin wrote:
> >     except:
>
>Are you sure the exception is what you think it is (cookie not set)?
>A bare "except:" will catch any exception.  It's better to explicitly
>state which exception you're excepting, except for the top-level
>"fallback of last resort" code.
>
>Have you tried putting "import traceback;  traceback.print_exc()"
>in the except: clause?  Then you can verify which exception is really
>being thrown.

Mike is right. A general except: is always a bad thing unless you really 
are writing a general catch-all bit of code for any kind of error. Even a 
misspelled variable name will be caught by except:

Try this:

         if self.request().hasCookie('firstVisit'):
                 doThis()
         else:
                 doThat()


-Chuck


_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to