Re: URLField and Web Sockets URLs

14 views
Skip to first unread message

Kurtis Mullins

unread,
Oct 4, 2012, 4:41:33 PM10/4/12
to django...@googlegroups.com
Looks like this is similar and shows that people want other protocols as well: http://stackoverflow.com/questions/8778416/what-are-the-valid-values-for-a-django-url-field

You could modify the validator's regex but I imagine the cleanest way to do this would be to make a copy of it in your own code base and modify/use accordingly.

I'm not sure on the best way to make proposals. Hopefully someone else can chime in there for you.

On Thu, Oct 4, 2012 at 12:51 PM, Julian Cerruti <jcer...@willowgarage.com> wrote:
Apparently the current implementation of URLField rejects Web Sockets URLs such as ws://my.server.com/

This seems to be due to the implementation of the underlying URLValidator, which has a regex to search for ftp or http based URLs only.

Is there any chance the URLValidator regexp can be updated to include ws as a valid protocol qualifier too?

Also, more generally, what is the recommended procedure for proposing changes (and accompanying code) such as this?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/ap-_kaacEngJ.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Russell Keith-Magee

unread,
Oct 4, 2012, 11:32:57 PM10/4/12
to django...@googlegroups.com
On Fri, Oct 5, 2012 at 12:51 AM, Julian Cerruti
<jcer...@willowgarage.com> wrote:
> Apparently the current implementation of URLField rejects Web Sockets URLs
> such as ws://my.server.com/
>
> This seems to be due to the implementation of the underlying URLValidator,
> which has a regex to search for ftp or http based URLs only.
>
> Is there any chance the URLValidator regexp can be updated to include ws as
> a valid protocol qualifier too?

Certainly possible. I might have some question as to whether Web
Sockets URLs should be allowed in the general case. The current field
validates for HTTP and FTP because they're the things you'd expect a
user to put into the field for a "Homepage", for example; a web socket
URL is an entirely valid URL, but it's not something you'd expect for
a homepage. A flag/option may be called for.

> Also, more generally, what is the recommended procedure for proposing
> changes (and accompanying code) such as this?

Open a ticket, provide a patch (with tests). Wait for someone to
review said patch. If the wait becomes too long, try reviewing someone
else's patch and get some karma in return.

Yours,
Russ Magee %-)

Julian Cerruti

unread,
Oct 5, 2012, 7:17:02 AM10/5/12
to django...@googlegroups.com
Thanks Kurtis and Russ.

For now, since this is a very minor feature of my app, I decided to go the easy route and turn my field into a CharField.

When I get some more time I will try to exercise the contribution mechanism as a way to get more familiarized with it.

Thank you guys both for your orientation.

Best,
Julian
Reply all
Reply to author
Forward
0 new messages