#35699: DatabaseOperations raise ValueError for valid GenericIPAddressField (inet)
value with psycopg3
-------------------------------------+-------------------------------------
Reporter: florianvazelle | Type: Bug
Status: new | Component: Database
| layer (models, ORM)
Version: | Severity: Normal
Keywords: | Triage Stage:
psycopg3,GenericIPAddressField | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
I move recently to psycopg3, and it's seems that the {{{Inet}}} class
change to be an alias of {{{ipaddress.ip_address}}} in
[
https://github.com/django/django/blob/main/django/db/backends/postgresql/psycopg_any.py#L12].
But some valid inet value raise an {{{ValueError}}}, such as:
{{{
>>> import ipaddress
>>> ipaddress.ip_address("192.168.1/24")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/florian/.pyenv/versions/3.11.9/lib/python3.11/ipaddress.py",
line 54, in ip_address
raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6
address')
ValueError: '192.168.1/24' does not appear to be an IPv4 or IPv6 address
}}}
--
Ticket URL: <
https://code.djangoproject.com/ticket/35699>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.