Fix previous commit on domain checking of id2url

* the condition on empty self.DOMAIN didn't work
* it introduced a regression as subdomains were accepted by the old code
This commit is contained in:
Laurent Bachelier 2011-04-22 10:37:30 +02:00
commit 2c6d5d4e70

View file

@ -55,7 +55,8 @@ def id2url(id2url):
def inner(self, *args, **kwargs):
arg = unicode(args[0])
if arg.startswith('http://') or arg.startswith('https://'):
if self.DOMAIN and self.DOMAIN == urlsplit(arg).netloc:
domain = urlsplit(arg).netloc
if not self.DOMAIN or self.DOMAIN == domain or domain.endswith('.'+self.DOMAIN):
url = arg
else:
return None