mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 12:49:01 +02:00
Add object string representation to truncation warning message
When we print a warning about the value of a CharField being truncated, print out the string representation of the object so we have a chance of finding the offending object. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
7710571935
commit
5568ba0ebf
|
@ -32,7 +32,7 @@ def truncate_charfield_values(sender, instance, *args, **kwargs):
|
|||
if isinstance(field, models.CharField):
|
||||
value = getattr(instance, field.name)
|
||||
if value and len(value) > field.max_length:
|
||||
logger.warning('%s.%s: length %s exceeds maximum (%s), truncating' % (instance.__class__.__name__, field.name, len(value), field.max_length))
|
||||
logger.warning('%s.%s: %s: length %s exceeds maximum (%s), truncating' % (instance.__class__.__name__, field.name, str(instance), len(value), field.max_length))
|
||||
setattr(instance, field.name, value[:field.max_length])
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user