Merge branch 'lingfish-patch-1'

This commit is contained in:
Konsta Vesterinen
2016-05-09 13:53:42 +03:00

View File

@@ -65,6 +65,14 @@ def force_auto_coercion(mapper=None):
document.background_color # Color object document.background_color # Color object
session.commit() session.commit()
A useful side-effect of this is that additional validation of data will be
done on the moment it is being assigned to model objects. For example
without auto coerction set, an invalid
:class:`sqlalchemy_utils.types.IPAddressType` (eg. ``10.0.0 255.255``)
would get through without an exception being raised. The database wouldn't
notice this (as most databases don't have a native type for an IP address,
so they're usually just stored as a string), and the ``ipaddress/ipaddr``
package uses a string field as well.
:param mapper: The mapper which the automatic data type coercion should be :param mapper: The mapper which the automatic data type coercion should be
applied to applied to