.. changelog::
:version: 1.1.2
+ .. change::
+ :tags: bug, sql
+ :tickets: 3823
+
+ Fixed a regression caused by a newly added function that performs the
+ "wrap callable" function of sql :class:`.DefaultGenerator` objects,
+ an attribute error raised for ``__module__`` when the default callable
+ was a ``functools.partial`` or other object that doesn't have a
+ ``__module__`` attribute.
+
+
.. changelog::
:version: 1.1.1
:released: October 7, 2016
else:
_f = wrapper
_f.__name__ = fn.__class__.__name__
- _f.__module__ = fn.__module__
+ if hasattr(fn, '__module__'):
+ _f.__module__ = fn.__module__
if hasattr(fn.__call__, '__doc__') and fn.__call__.__doc__:
_f.__doc__ = fn.__call__.__doc__
eq_(c.__name__, "MyFancyDefault")
eq_(c.__doc__, None)
+ def test_wrapping_update_wrapper_functools_parial(self):
+ def my_default(x):
+ return x
+
+ import functools
+ my_functools_default = functools.partial(my_default, 5)
+
+ c = util.wrap_callable(
+ lambda: my_functools_default(), my_functools_default)
+ eq_(c.__name__, "partial")
+ eq_(c.__doc__, my_functools_default.__call__.__doc__)
+ eq_(c(), 5)
+
class ToListTest(fixtures.TestBase):
def test_from_string(self):