diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-04-22 17:49:59 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-04-22 17:49:59 +0000 |
commit | 8bc6149ee80f4f40bcb1b4873dd436166d6037a2 (patch) | |
tree | b9f1c35b208edcadf9cb7be9a0daf8465c0a9397 /lib/sqlalchemy/databases/mysql.py | |
parent | e9c5f5eb010b5e204e7568392fac4b662d0afea1 (diff) | |
download | sqlalchemy-8bc6149ee80f4f40bcb1b4873dd436166d6037a2.tar.gz |
- support for SSL arguments given as inline within URL query string,
prefixed with "ssl_", courtesy terjeros@gmail.com.
Diffstat (limited to 'lib/sqlalchemy/databases/mysql.py')
-rw-r--r-- | lib/sqlalchemy/databases/mysql.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py index 52aa03003..cc503215a 100644 --- a/lib/sqlalchemy/databases/mysql.py +++ b/lib/sqlalchemy/databases/mysql.py @@ -293,8 +293,18 @@ class MySQLDialect(ansisql.ANSIDialect): # note: these two could break SA Unicode type util.coerce_kw_type(opts, 'use_unicode', bool) util.coerce_kw_type(opts, 'charset', str) - # TODO: what about options like "ssl", "cursorclass" and "conv" ? - + + # ssl + ssl = {} + for key in ['ssl_ca', 'ssl_key', 'ssl_cert', 'ssl_capath', 'ssl_cipher']: + if key in opts: + ssl[key[4:]] = opts[key] + util.coerce_kw_type(ssl, key[4:], str) + del opts[key] + if len(ssl): + opts['ssl'] = ssl + + # TODO: what about options like "cursorclass" and "conv" ? client_flag = opts.get('client_flag', 0) if self.dbapi is not None: try: @@ -302,7 +312,7 @@ class MySQLDialect(ansisql.ANSIDialect): client_flag |= CLIENT_FLAGS.FOUND_ROWS except: pass - opts['client_flag'] = client_flag + opts['client_flag'] = client_flag return [[], opts] def create_execution_context(self, *args, **kwargs): |