== Steps to reproduce ==
{{{
from django.core.validators import URLValidator
URLValidator(schemes=['file'])('file:///tmp/somefile')
}}}
== Expected result ==
No exception should be raised.
== Current result ==
{{{
ValidationError: [u'Enter a valid URL.']
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25595>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* component: Uncategorized => Core (Other)
* needs_tests: => 0
* needs_docs: => 0
Comment:
Can this be fixed without special casing the file scheme in the
validation?
--
Ticket URL: <https://code.djangoproject.com/ticket/25595#comment:1>
Comment (by claudep):
It's `URLValidator` not `URIValidator`, I think you might need your own
custom validator for this. The current regex is already bloated, I'm not
sure we should continue to complexify it...
--
Ticket URL: <https://code.djangoproject.com/ticket/25595#comment:2>
Comment (by timgraham):
I had a similar skepticism. If we don't make a change, then let's clarify
the documentation to prevent further tickets about this.
--
Ticket URL: <https://code.djangoproject.com/ticket/25595#comment:3>
Comment (by codingjoe):
I thinks this is both a documentation and code problem. The `URLValidator`
should raise a value error, if a unsupported schema is set. In the
documentation it should be explained with RFC 1738 schemas are supported.
Currently one gets the impression that all are.
--
Ticket URL: <https://code.djangoproject.com/ticket/25595#comment:4>
Comment (by codingjoe):
Interestingly enough, if you include the optional host parameter in
RFC1738 it works: `file://localhost/tmp/file/name`
--
Ticket URL: <https://code.djangoproject.com/ticket/25595#comment:5>