#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>