Raises a Python UserWarning if `entity` arguments contains an idref value.
(entity)
| 8 | |
| 9 | |
| 10 | def idref(entity): |
| 11 | """Raises a Python UserWarning if `entity` arguments contains an idref |
| 12 | value. |
| 13 | |
| 14 | """ |
| 15 | if not getattr(entity, 'idref', None): |
| 16 | return |
| 17 | |
| 18 | fmt = ("The use of idrefs has been deprecated for this field. " |
| 19 | "Received '{0}' object with idref: '{1}'.") |
| 20 | |
| 21 | msg = fmt.format(type(entity).__name__, entity.idref) |
| 22 | warnings.warn(msg) |
| 23 | |
| 24 | |
| 25 | def field(instance, value): |