From ecee1fb16cf6b7b5d01187191ea23260b8bcef2a Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 12 Nov 2006 20:50:51 +0000 Subject: - create_engine() reworked to be strict about incoming **kwargs. all keyword arguments must be consumed by one of the dialect, connection pool, and engine constructors, else a TypeError is thrown which describes the full set of invalid kwargs in relation to the selected dialect/pool/engine configuration. --- lib/sqlalchemy/util.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/util.py') diff --git a/lib/sqlalchemy/util.py b/lib/sqlalchemy/util.py index 3636d5523..bd40039d4 100644 --- a/lib/sqlalchemy/util.py +++ b/lib/sqlalchemy/util.py @@ -57,7 +57,18 @@ class ArgSingleton(type): instance = type.__call__(self, *args) ArgSingleton.instances[hashkey] = instance return instance - + +def get_cls_kwargs(cls): + """return the full set of legal kwargs for the given cls""" + kw = [] + for c in cls.__mro__: + cons = c.__init__ + if hasattr(cons, 'func_code'): + for vn in cons.func_code.co_varnames: + if vn != 'self': + kw.append(vn) + return kw + class SimpleProperty(object): """a "default" property accessor.""" def __init__(self, key): -- cgit v1.2.1