On a IDN setup, we are currently getting Punicode in the name due to the
init sequence:
{{{
def __init__(self, request):
self.domain = self.name = request.get_host()
}}}
IMHO a punicode version of the domain in not what I expect in the
{{{name}}} attribute.
I suggest that if the domains starts with {{{xn--}}} it should be tried to
set the name by decoding the domain from idna.
How do you think about it? (I may provide patch if you agree on the
behavior)
--
Ticket URL: <https://code.djangoproject.com/ticket/32537>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
> Without using django.contrib.sites, get_current_site reply a RequestSite
> instance defining name and domain.
>
> On a IDN setup, we are currently getting Punicode in the name due to the
> init sequence:
> {{{
> def __init__(self, request):
> self.domain = self.name = request.get_host()
> }}}
> IMHO a punicode version of the domain in not what I expect in the
> {{{name}}} attribute.
>
> I suggest that if the domains starts with {{{xn--}}} it should be tried
> to set the name by decoding the domain from idna.
>
> How do you think about it? (I may provide patch if you agree on the
> behavior)
New description:
Without using django.contrib.sites, get_current_site reply a RequestSite
instance defining name and domain.
On a IDN setup, we are currently getting Punicode in the name due to the
init sequence:
{{{
def __init__(self, request):
self.domain = self.name = request.get_host()
}}}
IMHO a punicode version of the domain in not what I expect in the
{{{name}}} attribute.
I suggest that if any part of the domains starts with {{{xn--}}} it should
be tried to set the name by decoding the domain from idna.
How do you think about it? (I may provide patch if you agree on the
behavior)
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32537#comment:1>
* status: new => closed
* resolution: => needsinfo
* component: Uncategorized => contrib.sites
* type: Uncategorized => New feature
Comment:
This is a [https://docs.djangoproject.com/en/3.1/ref/contrib/sites
/#requestsite-objects documented] behavior:
> ''"Sets the name and domain attributes to the value of
**get_host**()."''
and [https://docs.djangoproject.com/en/3.1/ref/request-
response/#django.http.HttpRequest.get_host get_host()] ''"returns the
originating host of the request using information from the ..."''
Decoding punycodes would be backward incompatible and it's not clear to me
why a puncode in `name` is an issue.
--
Ticket URL: <https://code.djangoproject.com/ticket/32537#comment:2>
Comment (by François Poulain):
> This is a documented behavior
Ok, thanks for the link.
> it's not clear to me why a puncode in name is an issue
I thought it because the
[https://docs.djangoproject.com/en/3.1/ref/contrib/sites/#django.contrib.sites.models.Site
models.Site documentation] states that {{{name}}} is "A human-readable
“verbose” name for the website."
--
Ticket URL: <https://code.djangoproject.com/ticket/32537#comment:3>