

def get_change_for_type(verbose_name, change, field):
    if isinstance(field, fields.files.ImageField):
        change = ImageChange(('Current %(verbose_name)s / New %(verbose_name)s' % {
            'verbose_name': verbose_name,
        }), field, change)
    else:
        (value1, value2) = change
        if (sys.version < '3'):
            if (value1 and ((type(value1) is str) or (type(value1) is unicode))):
                value1 = value1.encode('utf-8')
            if (value2 and ((type(value2) is str) or (type(value2) is unicode))):
                value2 = value2.encode('utf-8')
        change = TextChange(verbose_name, field, (str(value1), str(value2)))
    return change

dataset/ETHPy150Open dominno/django-moderation/moderation/diff.py get_change_for_type/original