ephes / django-cast

Django and Wagtail based blogging / podcasting app
Other
56 stars 6 forks source link

CommaSeparatedIntegerField Breaks on Non-Integer Input #156

Closed ephes closed 3 months ago

ephes commented 3 months ago

Last line of this code:

class CommaSeparatedIntegerField(forms.Field):
    def to_python(self, value: Any | None) -> list[int]:  # Any | None from super -> do not override
        if value is None or not value.strip():
            return []
        return [int(item.strip()) for item in value.split(",")]

Broke on this input: invalid literal for int() with base 10: 'if(now()=sysdate()'

Very funny.