summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/util.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-11-12 20:50:51 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-11-12 20:50:51 +0000
commitecee1fb16cf6b7b5d01187191ea23260b8bcef2a (patch)
tree58c9e83ed89f7b94bb6162ad9ab10a03281c31ae /lib/sqlalchemy/util.py
parent2d4e0d27dcbf9e7ab5718b203812c54c61ec3a40 (diff)
downloadsqlalchemy-ecee1fb16cf6b7b5d01187191ea23260b8bcef2a.tar.gz
- 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.
Diffstat (limited to 'lib/sqlalchemy/util.py')
-rw-r--r--lib/sqlalchemy/util.py13
1 files changed, 12 insertions, 1 deletions
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):