#16302: Ensure contrib (namely comments) is IPv6 capable
-----------------------+----------------------------------
Reporter: toofishes | Owner: nobody
Type: Bug | Status: new
Milestone: 1.4 | Component: contrib.comments
Version: SVN | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Easy pickings: 0
UI/UX: 0 |
-----------------------+----------------------------------
This is a follow-on ticket now that #811 has been implemented. What's the
design decision on updating `django.contrib.comments.models` to utilize
the new IPv6-capable address field? It appears to be the only core Django
application utilizing this field.
It assumes the value of REMOTE_ADDR can be coerced into the field, as you
can see in this line from `django/contrib/comments/views/comments.py`:
{{{
comment.ip_address = request.META.get("REMOTE_ADDR", None)
}}}
This currently populates PostgreSQL-backed instances correctly if hooked
up to an IPv6-capable webserver, but all other databases will fail or
truncate (perhaps even silently!) any non-IPv4 value exceeding 15
characters, such as `::ffff:192.168.100.1`. The prudent decision to me
seems to be to modify the Comment model to use:
{{{
ip_address = models.IPAddressField(_('IP address'), unpack_ipv4=True,
blank=True, null=True)
}}}
A change like this will require manual database migration for all storage
engines that use a char type for this; I'm not sure what your policy (if
any) is on that. Either way the end result is no worse than what currently
happens with truncation.
--
Ticket URL: <https://code.djangoproject.com/ticket/16302>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.