On Friday 29 December 2006 10:02, Oleg Broytmann wrote:
> > +        for c in range(0, 3):
> >              try:
> >                  if self.need_unicode:
> >                      # For MysqlDB 1.2.1 and later, we go
> > @@ -88,7 +100,9 @@
> >                  else:
> >                      return cursor.execute(query)
> >              except MySQLdb.OperationalError, e:
> > -                if e.args[0] == 2013: # SERVER_LOST error
> > +                if e.args[0] in (2006, 2013): # SERVER_GONE or
> > SERVER_LOST error +                    if c == 2:
> > +                        raise OperationalError(ErrorMessage(e))
>
>    I think I can move this "if...raise" out of the loop to "else"
> clause.

I was thinking of that, but wasn't sure if in the else clause the 
exception variable (e) is visible to be raised, so I took the safer 
approach. But if you know for sure it is visible in that context, than I 
agree it's more elegant to write it that way.
And BTW, the if c==2 is no longer needed in the else clause. Only a simple 
raise.

-- 
Dan

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to