Bare Excepts

Victor Subervi victorsubervi at gmail.com
Wed Dec 30 08:12:18 EST 2009


On Wed, Dec 30, 2009 at 9:09 AM, Victor Subervi <victorsubervi at gmail.com>wrote:

>
>> Anyway, you should definitely use a coding rule checker, like pylint or
> pyckeck. It would sometimes point you into the correct direction. For
> instance, pylint will tell you that except: pass is often (not always) a
> clue for bad design/pattern and issue warnings for it.
>
> How about this:

    try:
      id = form.getfirst('id')
      sql = 'update %s set ProdID="%s" Quantity="%s" %s where ID="%s";' %
(tmpTable, prodid, quantity, sqlUpdateMiddle, id)
      cursor.execute(sql)
      db.commit()
    except:
      raise

How does one get around sql calls that fail?
beno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091230/4a9d27f4/attachment-0001.html>


More information about the Python-list mailing list