google-code-export / django-page-cms

Automatically exported from code.google.com/p/django-page-cms
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

AutoRenderHttpError on pages that redirect with trailing backslash #168

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Setup a page to redirect to another CMS page
2. Access the page with a backslash. For example, if the slug is
"the-page", access the page like "/the-page/"
3. AutoRenderHttpError (traceback: http://dpaste.org/eOCi/)

What is the expected output? What do you see instead?

- Page should redirect as normal. Page redirects fine if no trailing slash.

Are you using the trunk version or a released version of this CMS?

- Trunk

Original issue reported on code.google.com by intellin...@gmail.com on 23 Sep 2009 at 3:28

GoogleCodeExporter commented 9 years ago
I cannot reproduce on the trunk. Can you check if it resolved?

Original comment by batiste....@gmail.com on 25 Sep 2009 at 8:07

GoogleCodeExporter commented 9 years ago
Ok, tested with rev 710, now corrected :) 

Original comment by m.meylan@gmail.com on 25 Sep 2009 at 10:03

GoogleCodeExporter commented 9 years ago
Hmm. Still looks to be broken for me...

Original comment by intellin...@gmail.com on 25 Sep 2009 at 2:15

GoogleCodeExporter commented 9 years ago
I'm not really sure why it's happening. I've poured through the code of two 
separate
sites. On one site, this error is happening, while on the other, it's completely
fine. I think of the page cms would render pages with or without backslashes, it
might fix the issue. Right now on one site, if I access without a trailing 
backslash,
it returns 404, but with the backslash, renders appropriately.

On the other site, with the backslash renders appropriately while without the
backslash returns the AutoRenderHttpError.

I'll see if I can dig deeper into this tonight.

Original comment by intellin...@gmail.com on 25 Sep 2009 at 2:36

GoogleCodeExporter commented 9 years ago
Ah - here's the underlying cause. It *only* happens on pages that are set to 
redirect
to another page. The other pages render fine with or without a trailing 
backslash.

To sum it up: on pages set to redirect to another page, if there's a trailing
backslash in the URL, AutoRenderHttpError will be thrown.

Original comment by intellin...@gmail.com on 25 Sep 2009 at 2:39

GoogleCodeExporter commented 9 years ago
I have been using the details view with only_context and only recently 
redirects were
added which now pops AutoRenderHttpError.

I worked around this by adding a only_response param to the auto_render 
decorator
(see
http://github.com/jbeaurain/django-page-cms/commit/e0a9963bbced0451be9c1f3508a04
75c9b0940f8
).

Instead of only_context I now do:

def pages_details_intercept(request, path=None):
    response = details(request, path=path, only_response=True)
    if isinstance(response, HttpResponse):
        return response
    (template_name, context) = response

Original comment by jacques....@gmail.com on 7 Jan 2010 at 12:52