#2801 Make trailing slash redirects use 301 instead of 302

v1.0.0
closed
General
nobody
2015-08-20
2011-09-14
No

In both sfpy & allura, tg.decorators.with_trailing_slash and without_trailing_slash should be monkey-patched so they cause a 301 instead of 302. I'd rather not copy the whole functions, even though they're short, because the logic is a little complex. Maybe we can capture the exception that it raises and then re-raise a 301 exception.

Discussion

  • Dave Brondsema

    Dave Brondsema - 2011-09-19
    • size: --> 2
     
  • Jenny Steele - 2011-09-22
    • status: open --> in-progress
    • assigned_to: Jenny Steele
     
  • Jenny Steele - 2011-09-22
    • status: in-progress --> code-review
    • assigned_to: Jenny Steele --> Dave Brondsema
     
  • Jenny Steele - 2011-09-22

    Changes are on allura and sfpy js/2801. To test hit some urls that use the decorators and make sure you get a 301 like: curl http://sf-jsteele-6025.sb.sf.net/create. I couldn't figure out how to wrap the decorators like the description suggests, but there were only 2 lines copied per function.

     
  • Dave Brondsema

    Dave Brondsema - 2011-09-26
    • status: code-review --> closed
     
  • Dave Brondsema

    Dave Brondsema - 2011-09-26
    • status: closed --> in-progress
    • assigned_to: Dave Brondsema --> Jenny Steele
     
  • Dave Brondsema

    Dave Brondsema - 2011-09-26

    I merged these to dev, but later realized that while these work in practice, they don't apply to our tests. Maybe the monkeypatching needs to happen somewhere else? It isn't the end of the world, but I'd much prefer that our tests function the same as paster/mod_wsgi. Of course, that'll mean a lot of s/302/301/ in our tests too.

     
  • Jenny Steele - 2011-09-27

    I added a test for the redirect on js/2801. We are getting 301s correctly inside the tests, but we didn't have any tests before that tested the slashiness decorators (presumably they are tested in tg). The tests that currently exist and look for 302s are for form redirects which should stay 302s, right? As in, submit the form and get redirected to another page when successful.

     
  • Jenny Steele - 2011-09-27
    • status: in-progress --> code-review
    • assigned_to: Jenny Steele --> Dave Brondsema
     
  • Dave Brondsema

    Dave Brondsema - 2011-09-28

    The problem is in sfpy - test_project_without_slash and test_folder_without_slash should pass with 301s

     
  • Dave Brondsema

    Dave Brondsema - 2011-09-28
    • status: code-review --> in-progress
    • assigned_to: Dave Brondsema --> Jenny Steele
     
  • Dave Brondsema

    Dave Brondsema - 2011-09-28
    • status: in-progress --> closed
     

Log in to post a comment.