Handle case where subdomain is None in is_subdomain.

This commit is contained in:
Max Goodman
2011-10-18 18:39:14 -07:00
parent c72a8925bb
commit 235bcabf81

View File

@@ -213,7 +213,7 @@ def strip_www(domain):
def is_subdomain(subdomain, base):
"""Check if a domain is equal to or a subdomain of a base domain."""
return subdomain == base or subdomain.endswith('.' + base)
return subdomain == base or (subdomain is not None and subdomain.endswith('.' + base))
r_base_url = re.compile("(?i)(?:.+?://)?(?:www[\d]*\.)?([^#]*[^#/])/?")
def base_url(url):