#36332: Usage notes and examples for HttpRequest.path and HttpRequest.path_info 
in
docs are mixed up
-------------------------------------+-------------------------------------
     Reporter:  Kashemir001          |                    Owner:  (none)
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Documentation        |                  Version:  5.2
     Severity:  Normal               |               Resolution:
     Keywords:  wsgi httprequest     |             Triage Stage:  Accepted
  path_info                          |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Kashemir001):

 Replying to [comment:2 Sarah Boyce]:
 > Would you like to create a PR?
 > It might make sense to also update the linked test to be less misleading

 Alright, I'll give it a go. Will switching attribute values and
 corresponding asserts be enough for the tests? Something about:

 {{{#!diff
 --- a/tests/requests_tests/tests.py
 +++ b/tests/requests_tests/tests.py
 @@ -54,17 +54,17 @@
     def test_httprequest_full_path(self):
         request = HttpRequest()
 -       request.path = "/;some/?awful/=path/foo:bar/"
 -       request.path_info = "/prefix" + request.path
 +       request.path_info = "/;some/?awful/=path/foo:bar/"
 +       request.path = "/prefix" + request.path_info
         request.META["QUERY_STRING"] = ";some=query&+query=string"
         expected =
 "/%3Bsome/%3Fawful/%3Dpath/foo:bar/?;some=query&+query=string"
 -       self.assertEqual(request.get_full_path(), expected)
 -       self.assertEqual(request.get_full_path_info(), "/prefix" +
 expected)
 +       self.assertEqual(request.get_full_path_info(), expected)
 +       self.assertEqual(request.get_full_path(), "/prefix" + expected)

     def test_httprequest_full_path_with_query_string_and_fragment(self):
         request = HttpRequest()
 -       request.path = "/foo#bar"
 -       request.path_info = "/prefix" + request.path
 +       request.path_info = "/foo#bar"
 +       request.path = "/prefix" + request.path_info
         request.META["QUERY_STRING"] = "baz#quux"
 -       self.assertEqual(request.get_full_path(), "/foo%23bar?baz#quux")
 -       self.assertEqual(request.get_full_path_info(),
 "/prefix/foo%23bar?baz#quux")
 +       self.assertEqual(request.get_full_path_info(),
 "/foo%23bar?baz#quux")
 +       self.assertEqual(request.get_full_path(),
 "/prefix/foo%23bar?baz#quux")

 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36332#comment:3>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019645221f9f-d2ff6607-d618-48c7-9ec3-799326ffc1a0-000000%40eu-central-1.amazonses.com.

Reply via email to