In trunk now

On Jul 28, 1:58 pm, mwolfe02 <michael.joseph.wo...@gmail.com> wrote:
> There's a generic except: in dal.py/sql.py that prevents SyntaxErrors
> from being reported.
>
> For example,
>
> db = DAL('mssql://user:p...@127.0.0.1/')
>
> results in:
>
> RuntimeError: Failure to connect to DB. Tried 5 times
>
> instead of:
>
> SyntaxError: Invalid URI string in SQLDB: mssql://user:p...@127.0.0.1/
>
> Unless there is some reason for ignoring SyntaxErrors that I'm not
> aware of, I'd like to propose the following patch:
>
> diff -r e1d065e37948 -r 80311269f4f3 gluon/dal.py
> --- a/gluon/dal.py      Mon Jul 26 03:44:13 2010 -0500
> +++ b/gluon/dal.py      Wed Jul 28 14:41:33 2010 -0400
> @@ -2039,6 +2039,8 @@
>                      self._adapter = ADAPTERS[prefix+self._dbname]
> (self,uri,pool_size,folder,db_codec)
>                      connected = True
>                      break
> +                except SyntaxError:
> +                    raise
>                  except:
>                      time.sleep(1)
>              if not connected:
> diff -r e1d065e37948 -r 80311269f4f3 gluon/sql.py
> --- a/gluon/sql.py      Mon Jul 26 03:44:13 2010 -0500
> +++ b/gluon/sql.py      Wed Jul 28 14:41:33 2010 -0400
> @@ -3883,6 +3883,8 @@
>                  return SQLDB(uri, pool_size=pool_size, folder=folder,
>                               db_codec=db_codec,
> check_reserved=check_reserved,
>                               migrate=migrate,
> fake_migrate=fake_migrate)
> +            except SyntaxError:
> +                raise
>              except:
>                  time.sleep(1)
>          raise RuntimeError, "Failure to connect to DB. Tried 5 times"

Reply via email to