When generating dummy requests for pages with no routable URL, fall back on a hostname from ALLOWED_HOSTS and finally localhost

stable/0.3.x
Matt Westcott 2014-06-03 14:15:18 +01:00
rodzic c7b997bd02
commit f3f7b466b1
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -581,7 +581,12 @@ class Page(MP_Node, ClusterableModel, Indexed):
path = url_info.path
port = url_info.port or 80
else:
hostname = 'example.com'
# Cannot determine a URL to this page - cobble one together based on
# whatever we find in ALLOWED_HOSTS
try:
hostname = settings.ALLOWED_HOSTS[0]
except IndexError:
hostname = 'localhost'
path = '/'
port = 80