pombreda / 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

malformed template name for ajax request #219

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. request a cms page through an ajax request

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

I obtain a 500 error instead of the expected page

Are you using the master version or a released version of this CMS on the
github repository?

version 1.4.0

If you can write a test that reproduce the problem, there is better chance
it will be resolved quickly.

my PAGE_TEMPLATES settings is a list like this:

PAGE_TEMPLATES = (
  ('subdir/template.html', 'template'),
)

when you add the prefix "body_" to the template you don't split the subdir from 
the filename.

Original issue reported on code.google.com by cinghial...@gmail.com on 9 Mar 2011 at 5:11

Attachments:

GoogleCodeExporter commented 9 years ago
I've attached a patch for this

Original comment by cinghial...@gmail.com on 9 Mar 2011 at 5:11

GoogleCodeExporter commented 9 years ago
This has been removed in the latest CMS version
https://github.com/batiste/django-page-cms/commit/d9b59992b2039193a8166258efbe4b
3557c98682

Original comment by batiste....@gmail.com on 10 Mar 2011 at 6:50

GoogleCodeExporter commented 9 years ago
I understand why it has been removed. In three years of use of the cms I have 
never needed it :)

What do you think about a new, optional, settings "PAGES_TEMPLATE_NAME_HOOK" a 
callable with signature (request, page) that can freely alter the template_name?

Original comment by cinghial...@gmail.com on 10 Mar 2011 at 11:00

GoogleCodeExporter commented 9 years ago
Obviously, if you are interested, I can prepare a patch to implement my 
suggestion.

Original comment by cinghial...@gmail.com on 10 Mar 2011 at 11:02

GoogleCodeExporter commented 9 years ago
That seems like a good idea! I highly welcome any sort of contribution.

You could also add a method in class pages.views.Details. The user could then 
decide to subclass it if he wants. That would avoid one more of those settings.

Actually there is already the get_template method you can redefine... Is that 
enough to cover your needs?

Original comment by batiste....@gmail.com on 10 Mar 2011 at 11:42