diff options
author | Martin J. Hsu <martin.hsu@gmail.com> | 2015-09-25 16:15:28 +0800 |
---|---|---|
committer | Martin J. Hsu <martin.hsu@gmail.com> | 2015-10-15 10:46:33 +0800 |
commit | c7d04beeac6ad54d638afb01783dee2d769aef9d (patch) | |
tree | d085f54e97c06138ecbb5ce30898f5b8aeda936f /lib/sqlalchemy/sql/schema.py | |
parent | 91255618ddb47553774c620a23479adf88c27b74 (diff) | |
download | sqlalchemy-pr/204.tar.gz |
- wrap ColumnDefault empty arg callables like functools.wraps, setting __name__, __doc__, and __module__pr/204
Diffstat (limited to 'lib/sqlalchemy/sql/schema.py')
-rw-r--r-- | lib/sqlalchemy/sql/schema.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py index 137208584..0c433d16e 100644 --- a/lib/sqlalchemy/sql/schema.py +++ b/lib/sqlalchemy/sql/schema.py @@ -1981,13 +1981,14 @@ class ColumnDefault(DefaultGenerator): try: argspec = util.get_callable_argspec(fn, no_self=True) except TypeError: - return lambda ctx: fn() + return util.wrap_callable(fn) defaulted = argspec[3] is not None and len(argspec[3]) or 0 positionals = len(argspec[0]) - defaulted if positionals == 0: - return lambda ctx: fn() + return util.wrap_callable(fn) + elif positionals == 1: return fn else: |