Doubt about urlencode filter implementation

View: New views
2 Messages — Rating Filter:   Alert me  

Doubt about urlencode filter implementation

by Danilo Cabello :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

Looking for urlencode[1] implementation, I saw[2] that it uses
urlquote on django.utils.http[3] and when I try to encode and URL like
"http://www.google.com" using that filter, I receive the follow return
"http%3A//www.google.com":

>>> from django.template.defaultfilters import urlencode
>>> urlencode('http://www.google.com')
u'http%3A//www.google.com'

My doubt: is that the expected result when using this filter?

If not I can submit a ticket with the patch.

Regards,
Danilo Cabello

[1] - http://docs.djangoproject.com/en/dev/ref/templates/builtins/#urlencode
[2] - http://code.djangoproject.com/browser/django/trunk/django/template/defaultfilters.py#L292
[3] - http://code.djangoproject.com/browser/django/trunk/django/utils/http.py#L10

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-developers@...
To unsubscribe from this group, send email to django-developers+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Doubt about urlencode filter implementation

by Joe Tyson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I believe that's the expected outcome.. The use is to encode something for the use in an URL...

Eg. convert "some-crazy//user?input" into something that can safely be passed into http://www.google.com/search?q=URL_ENCODED_STRING

On Sun, Oct 25, 2009 at 9:14 PM, Danilo Cabello <danilo.cabello@...> wrote:

Hi,

Looking for urlencode[1] implementation, I saw[2] that it uses
urlquote on django.utils.http[3] and when I try to encode and URL like
"http://www.google.com" using that filter, I receive the follow return
"http%3A//www.google.com":

>>> from django.template.defaultfilters import urlencode
>>> urlencode('http://www.google.com')
u'http%3A//www.google.com'

My doubt: is that the expected result when using this filter?

If not I can submit a ticket with the patch.

Regards,
Danilo Cabello

[1] - http://docs.djangoproject.com/en/dev/ref/templates/builtins/#urlencode
[2] - http://code.djangoproject.com/browser/django/trunk/django/template/defaultfilters.py#L292
[3] - http://code.djangoproject.com/browser/django/trunk/django/utils/http.py#L10




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-developers@...
To unsubscribe from this group, send email to django-developers+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---