Add more sane default

This commit is contained in:
Konsta Vesterinen
2014-01-30 13:21:30 +02:00
parent fa5d1eadbf
commit 1761d03af1

View File

@@ -72,7 +72,7 @@ def force_auto_coercion(mapper=None):
sa.event.listen(mapper, 'mapper_configured', coercion_listener) sa.event.listen(mapper, 'mapper_configured', coercion_listener)
def force_instant_defaults(mapper=sa.orm.mapper): def force_instant_defaults(mapper=None):
""" """
Function that assigns object column defaults on object initialization Function that assigns object column defaults on object initialization
time. By default calling this function applies instant defaults to all time. By default calling this function applies instant defaults to all
@@ -103,4 +103,6 @@ def force_instant_defaults(mapper=sa.orm.mapper):
:param mapper: The mapper which the automatic instant defaults forcing :param mapper: The mapper which the automatic instant defaults forcing
should be applied to should be applied to
""" """
if mapper is None:
mapper = sa.orm.mapper
sa.event.listen(mapper, 'init', instant_defaults_listener) sa.event.listen(mapper, 'init', instant_defaults_listener)