Author: jab Date: 2008-10-17 16:22:44 -0600 (Fri, 17 Oct 2008) New Revision: 3628
Modified: FormEncode/trunk/docs/news.txt FormEncode/trunk/formencode/validators.py Log: Fix :PORT in validators.URL, and remove the newlines in the path matcher for URL, as you can't actually use verbose comments and newlines in a character group Modified: FormEncode/trunk/docs/news.txt =================================================================== --- FormEncode/trunk/docs/news.txt 2008-10-17 20:06:22 UTC (rev 3627) +++ FormEncode/trunk/docs/news.txt 2008-10-17 22:22:44 UTC (rev 3628) @@ -46,6 +46,9 @@ * Quiet Python 2.6 deprecation warnings. +* Fix :class:`formencode.validators.URL`, which was accepting illegal + characters (like newlines) and did not accept http://domain:PORT/ + 1.0.1 ----- Modified: FormEncode/trunk/formencode/validators.py =================================================================== --- FormEncode/trunk/formencode/validators.py 2008-10-17 20:06:22 UTC (rev 3627) +++ FormEncode/trunk/formencode/validators.py 2008-10-17 22:22:44 UTC (rev 3628) @@ -1384,6 +1384,12 @@ 'http://hahaha.ha/bar.html' >>> u.to_python('http://xn--m7r7ml7t24h.com') 'http://xn--m7r7ml7t24h.com' + >>> u.to_python('http://foo.com:8000/test.html') + 'http://foo.com:8000/test.html' + >>> u.to_python('http://foo.com/something\\nelse') + Traceback (most recent call last): + ... + Invalid: That is not a valid URL >>> u.to_python('https://test.com') 'https://test.com' >>> u.to_python('http://test') @@ -1426,18 +1432,10 @@ (?:[%:\w]*@)? # authenticator (?P<domain>[a-z0-9][a-z0-9\-]{1,62}\.)* # (sub)domain - alpha followed by 62max chars (63 total) (?P<tld>[a-z]{2,}) # TLD - (?:[0-9]+)? # port + (?::[0-9]+)? # port # files/delims/etc - (?:/[ - # rfc3986 valid chars - # unreserved - a-z0-9\-\._~ - # delims - general - :/\?#\[\]@ - # delims - sub - !\$&\'\(\)\*\+,;= - ]*)? + (?P<path>/[a-z0-9\-\._~:/[EMAIL PROTECTED]&\'\(\)\*\+,;=]*)? $ ''', re.I | re.VERBOSE) ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ FormEncode-CVS mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/formencode-cvs
