in gluon/dal.py you can find this....
def __init__(self, uri='sqlite://dummy.db',
pool_size=0, folder=None,
db_codec='UTF-8', check_reserved=None,
migrate=True, fake_migrate=False,
migrate_enabled=True, fake_migrate_all=False,
decode_credentials=False, driver_args=None,
adapter_args=None, attempts=5, auto_import=False):
if not decode_credentials:
credential_decoder = lambda cred: cred
else:
credential_decoder = lambda cred: urllib.unquote(cred)
try to quote the credentials and set decode_credentials to True
On Feb 6, 7:18 am, Hugh Barker <[email protected]> wrote:
> Hi,
> I have a bit of a problem with my connection string in db.py -
> specifically, the database password has a '@' symbol, and so web2py chokes
> because it assumes this is the delimiter between password and host.
>
> I had a look at dal.py and I guess the regex needs modifying to take this
> case into account. Unfortunately my regex skills are pretty rudimentary - I
> spent an hour or so trying to nut it out, but didn't get anywhere, so I
> thought I'd ask you guys. The code is around line 1800 of dal.py:
>
> uri = uri.split('://')[1]
> m =
> re.compile('^(?P<user>[^:@]+)(\:(?P<password>[^@]*))?@(?P<host>[^\:@/]+)(\:(?P<port>[0-9]+))?/(?P<db>[^\?]+)(\?sslmode=(?P<sslmode>.+))?$').match(uri)
> if not m:
> raise SyntaxError, "Invalid URI string in DAL"
>
> I can see what it's doing and where it's going wrong, just not how to fix
> it :(
>
> Any help is appreciated.. I guess the easy option is to change the DB
> password, but unfortunately that isn't an option for me.
>
> Cheers,
> Hugh.