ecometrica / django-multisite

Multisite in django — use one Django app to serve multiple domains
BSD 3-Clause "New" or "Revised" License
138 stars 42 forks source link

Resolve normalized domain names #56

Open ziima opened 6 years ago

ziima commented 6 years ago

A domain name can be supplied in a number of ways. I found out, that multisite doesn't account for that. For example domain names example.com and example.com. which refer to the same object do not behave as such.

from multisite.models import Alias
Alias.objects.resolve('example.com')  # Returns <Alias: example.com -> example.com>
Alias.objects.resolve('example.com.')  # Returns None

I suggest to convert the domain name into preferred name syntax, see https://tools.ietf.org/html/rfc1035.html#section-2.3.1, before the domain is actually resolved.