web.database fails when password contains parens

Bug #328234 reported by bugreporter
2
Affects Status Importance Assigned to Milestone
web.py
Invalid
Undecided
Unassigned

Bug Description

I connect with something like:

db = web.database(dbn='mysql', user='username', pw='*()', db='dbname')

then, when trying to query the database:

db.query("SELECT * FROM FOO")

I get an exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/web/db.py", line 578, in query
    db_cursor = self._db_cursor()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/web/db.py", line 496, in _db_cursor
    return self.ctx.db.cursor()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/web/db.py", line 437, in _getctx
    self._load_context(self._ctx)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/web/db.py", line 448, in _load_context
    ctx.db = self._connect(self.keywords)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/web/db.py", line 476, in _connect
    return self.db_module.connect(**keywords)
  File "build/bdist.macosx-10.3-ppc/egg/MySQLdb/__init__.py", line 74, in Connect

  File "build/bdist.macosx-10.3-ppc/egg/MySQLdb/connections.py", line 170, in __init__
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)")

Changing my password fixes the problem, so I assume it doesn't like something in there (probably the parens).

Revision history for this message
Anand Chitipothu (anandology) wrote :

Works for me.

>>> import web
>>> db = web.database(dbn="mysql", db="test", user="anand", pw="*()")
>>> db.query("SELECT * FROM test").list()
0.0 (1): SELECT * FROM test
[]

Changed in webpy:
status: New → Invalid
milestone: none → 0.33
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.