Thanks for the tip! Worked great, except I used decode_credentials=True as the last argument. This was in version 1.91.6.
On Jan 21, 5:30 pm, Massimo Di Pierro <[email protected]> wrote: > The proper way to handle this is the following: > > from urllib import quote, unquote > > db = DAL('mssql://%s:%s@hostname:password/db' % > (quote(username),quote(password)),credential_decoder=unquote) > > On Jan 21, 3:45 pm, Loren McGinnis <[email protected]> wrote:> I > recently tried connecting to an mssql legacy database, and was > > getting errors upon trying to connect. > > > I found out the problem, which was very specific to my case: I had an > > "@" in my password. The regex currently used to parse the driver > > string is: > > > '^(?P<user>[^:@]+)(\:(?P<password>[^@]*))?@(?P<host>[^\:/]+)(\:(? > > P<port>[0-9]+))?/(?P<db>[^\?]+)(\?(?P<urlargs>.*))?$' > > > This truncated the password before the "@" and appended the rest onto > > the hostname. I fixed it with this change, allowing the password to > > be any characters: > > > '^(?P<user>[^:@]+)(\:(?P<password>.*))?@(?P<host>[^\:/]+)(\:(? > > P<port>[0-9]+))?/(?P<db>[^\?]+)(\?(?P<urlargs>.*))?$' > > > It successfully parsed the string and connected after the change. Of > > course, there would still be an issue if "@" showed up later in the > > connection string (would this ever happen?), since I'm depending upon > > a greedy qualifier to grab the whole password.

