Updated Page.dummy_request() to be able to handle ALLOWED_HOSTS = ['*'].

pull/2540/head
Robert Rollins 2016-04-19 13:24:53 -07:00 zatwierdzone przez Matt Westcott
rodzic 220dfb631d
commit bd8aedbc71
1 zmienionych plików z 4 dodań i 0 usunięć

Wyświetl plik

@ -1194,6 +1194,10 @@ class Page(six.with_metaclass(PageBase, MP_Node, ClusterableModel, index.Indexed
# whatever we find in ALLOWED_HOSTS
try:
hostname = settings.ALLOWED_HOSTS[0]
if hostname == '*':
# '*' is a valid value to find in ALLOWED_HOSTS[0], but it's not a valid domain name.
# So we pretend it isn't there.
raise IndexError
except IndexError:
hostname = 'localhost'
path = '/'