#5982: Different behaviour for url parameter in dev run versus test run
-----------------------------------------------+----------------------------
Reporter: Manoj Govindan <[EMAIL PROTECTED]> | Owner: nobody
Status: new | Component: Unit test system
Version: SVN | Keywords:
Stage: Unreviewed | Has_patch: 0
-----------------------------------------------+----------------------------
URL configuration:
{{{
url(r'^/find_thing/(?P<thing_name>.+)/$',
'django_mi.app.views.find_thing', name = 'find_thing'),
}}}
View:
{{{
def find_thing(request, thing_name):
print thing_name
# perform look up of thing and return.
}}}
In the development environment (manage.py runserver) the view works well
when passed a string with a space in it, say 'my thing'.
The portion of the url representing the parameter shows up as
'my%20thing'.
I then wrote a test for the view using Django's test client. I used the
utility reverse() method to pass the path to Client.get().
The test failed (the query set was empty) for identical input.
I added a print statement inside the view. On accessing the view in the
development environment the parameter was printed as
'my thing'. However on running the test it was printed as 'my%20thing'.
The latter caused the database lookup to return empty.
Why is the behaviour different in development/production and testing?
--
Ticket URL: <http://code.djangoproject.com/ticket/5982>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---