Opened 18 years ago
Closed 17 years ago
#3228 closed enhancement (fixed)
Added SmartSlashMiddleware
Reported by: | Owned by: | Malcolm Tredinnick | |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | normal | Keywords: | APPEND_SLASH middleware |
Cc: | jesse.lovelace@…, silassewell@…, andy-django@…, real.human@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Implements a new way of 'append slash redirect', as described here:
http://groups.google.com/group/django-developers/browse_thread/thread/d6ca6e1442658598
This patch requires some of the small refactorings from ticket #3224.
Attachments (5)
Change History (28)
by , 18 years ago
Attachment: | smartslash.diff added |
---|
comment:1 by , 18 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:2 by , 18 years ago
Needs documentation: | set |
---|
I'm +0 on this, I guess. If we do use it, I think it should replace the existing APPEND_SLASH behaviour in CommonMiddleware, rather than becoming yet another option. It looks like it will work fairly smoothly in cases where APPEND_SLASH is currently being used. However, we will need the facility to disable it entirely, just as with APPEND_SLASH.
comment:3 by , 18 years ago
+1 on this patch replacing the existing APPEND_SLASH behavior. When I want to create a URL without an end slash, I shouldn't have to set a flag that breaks the admin interface. This patch puts the control of URLs where it should be -- in urls.py.
comment:4 by , 18 years ago
Cc: | added |
---|
comment:5 by , 18 years ago
Cc: | added |
---|
comment:6 by , 18 years ago
Cc: | added |
---|
comment:7 by , 18 years ago
Cc: | added |
---|
+1 on this from me too. We should be able to define URLS that specifically do or do not end in a slash in urls.py, instead of having to choose one or the other and depending on files containing a period.
comment:9 by , 17 years ago
Patch needs improvement: | set |
---|---|
Summary: | [patch] Added SmartSlashMiddleware → Added SmartSlashMiddleware |
Can one of the +1 commenters here want to fix up the current patch to trunk and implement Malcolm's suggestions above?
comment:10 by , 17 years ago
Just checking - Malcolm's suggestions are to:
- port smartslash.diff to replace the existing APPEND_SLASH behaviour in CommonMiddleware?
- and to provide a patch for the docs?
Are there any backwards compatibility concerns about changing the current behaviour?
by , 17 years ago
Attachment: | smartslash-2.diff added |
---|
comment:11 by , 17 years ago
Attached is a new patch to replace the existing APPEND_SLASH behaviour in CommonMiddleware, with unit tests.
If this looks ok, I'll do up a patch as well for the docs.
cheers,
comment:12 by , 17 years ago
Just a quick note, smartslash-2.diff doesn't require the refactorings from ticket #3224.
comment:13 by , 17 years ago
Gentle bump for review - we're using this patch over at http://rst2a.com - it'd be great to get something which has this effect back into trunk.
Cheers!
comment:14 by , 17 years ago
Triage Stage: | Design decision needed → Ready for checkin |
---|
comment:15 by , 17 years ago
Two small problems before this can be checked in:
- lines 59-69 (the exception message) won't work as expected. It's not a multi-line string. Wrap things in parentheses or something.
- There should be a small documentation change to middleware.txt included to describe the new behaviour.
comment:16 by , 17 years ago
Triage Stage: | Ready for checkin → Accepted |
---|
comment:17 by , 17 years ago
Hey Malcolm, I can get those things fixed up in the next couple of hours if you like.
Not sure if you have started on these fixes yet?
I did an svn up the other day, and got some conflicts on this patch. I think they need to be resolved as well.
comment:19 by , 17 years ago
Owner: | changed from | to
---|
comment:20 by , 17 years ago
- damn sorry, overlooked the lines 59-69 the, i've added a test for it and fixed
- docs updated
- resolved conflicts
- http.get_host(request) updated to request.get_host()
- added test for #5762 and reapplied the urlquote change
- now making use of tests/urls.py which gets rid of the URLCONF hackery in the middleware test setUp
by , 17 years ago
Attachment: | smartslash-3.diff added |
---|
comment:21 by , 17 years ago
Needs documentation: | unset |
---|---|
Owner: | changed from | to
Patch needs improvement: | unset |
Triage Stage: | Accepted → Ready for checkin |
comment:23 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
SmartSlashMiddleware