628: Allow internal bug_tracker URLs (unqualified hostnames)
- Fixed
- Review Board
| timw.a******@gmai***** (Google Code) (Is this you? Claim this profile.) | |
| Nov. 13, 2008 |
Describe the enhancement and the motivation for it.
The repository editor currently prohibits 'http://bugs/%s'. Looking in the
django code, this is caused by URLField's insistence on a fully-qualified
domain name (with two or more components).
What operating system are you using? What browser?
Linux (Ubuntu 8.04 32-bit), Firefox 3.0
Please provide any additional information below.
The problem is with url_re. Below is a modified version that is less strict
about domain matching (django/forms/fields.py line 523).
url_re = re.compile(
r'^https?://' # http:// or https://
r'(?:(?:[A-Z0-9_-]+\.)*(?:[A-Z_][A-Z0-9_-]*)|' #domain...
r'localhost|' #localhost...
r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' # ...or ip
r'(?::\d+)?' # optional port
r'(?:/?|/.+)$', re.IGNORECASE)
I doubt I'd be able to: it's a patch to django's source. It looks like they have a ticket filed already: http://code.djangoproject.com/ticket/7969 Another local fix could be to mark that field as a string field and let site administrators be smart about their own requirements (this would also alleviate other restrictions I notice in django's tracker about URLField rejecting real domains). I will post a review of the latter suggestion: switching to CharField.
Oh I see. Yeah, that's a shame. Maybe it's time to introduce a URIField. We've been needing something more flexible than URLField to support non-http(s) URIs, and while we're at it we should allow for non-fully-qualified domains.