added support for validating a whole bunch of stuff that I can't reme… · dstufft/html5lib-python@a83fbe4 · GitHub
Skip to content

Commit a83fbe4

Browse files
author
Mark Pilgrim
committed
added support for validating a whole bunch of stuff that I can't remember right at the moment
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40990
1 parent f37d906 commit a83fbe4

3 files changed

Lines changed: 184 additions & 43 deletions

File tree

src/html5lib/filters/rfc2046.py

Lines changed: 29 additions & 0 deletions

src/html5lib/filters/rfc3987.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"urn", "go", "h323", "ipp", "tftp", "mupdate", "pres", "im", "mtqp",
3232
"iris.beep", "dict", "snmp", "crid", "tag", "dns", "info"
3333
]
34+
allowed_schemes = iana_schemes + ['javascript']
3435

3536
rfc2396_re = re.compile("([a-zA-Z][0-9a-zA-Z+\\-\\.]*:)?/{0,2}" +
3637
"[0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%,#]*$")
@@ -62,8 +63,8 @@ def isValidURI(value, uriPattern=rfc2396_re):
6263
elif scheme in ['http','ftp']:
6364
if not re.match('^\w+://[^/].*',value):
6465
return False, "invalid-http-or-ftp-uri"
65-
elif value.find(':')>=0 and scheme.isalpha() and scheme not in iana_schemes:
66-
return False, "unregistered-scheme"
66+
elif value.find(':')>=0 and scheme.isalpha() and scheme not in allowed_schemes:
67+
return False, "invalid-scheme"
6768
return True, ""
6869

6970
def isValidIRI(value):

src/html5lib/filters/validator.py

Lines changed: 152 additions & 41 deletions

0 commit comments

Comments
 (0)