Custom content type rendered with contentview.pt

3 views
Skip to first unread message

bismigalis

unread,
Dec 26, 2011, 2:02:31 AM12/26/11
to ptahproject
I'm trying to add new content type News, copied and renamed page.py
and page.pt to news.py and news.pt, now news instance rendered with
contentview.pt not with news.pt.

link to news.py http://pastebin.com/kUr2NA9J

bismigalis

unread,
Dec 26, 2011, 2:12:57 AM12/26/11
to ptahproject
Forgot to say, it is in ptah_minicms example.

Alan Runyan

unread,
Dec 26, 2011, 2:11:34 PM12/26/11
to ptahp...@googlegroups.com
This is one of the downsides of using the declarative security, the last import wins.  In this case ptah_minicms.views imported *after* your news.py

If you change app.py and specifically add your view configuration it will work as expected.  Before transaction.commit() add::

    from . import news
    config.add_view(context=news.News,
                    permission=ptah.cms.View,
                    wrapper=ptah.wrap_layout(),
                    renderer='ptah_minicms:templates/news.pt')

--
Alan Runyan

Skype/Twitter:: runyaga
http://ploud.com/  Plone site in less than 10 seconds

Nikolay Kim

unread,
Dec 27, 2011, 12:51:57 AM12/27/11
to ptahp...@googlegroups.com


you cant use this code

• view_config(
• context=News,
• permission=ptah.cms.View,
• wrapper=ptah.wrap_layout(),
• renderer='ptah_minicms:templates/news.pt')(ptah.View)

you actually create venusian action for ptah.View class and Configurator.scan() cant find it.

this code should work:

@view_config(context=News, ...)
class newsView(ptah.View):
...

bismigalis

unread,
Dec 27, 2011, 3:36:48 AM12/27/11
to ptahproject
Now I understand, thank you guys.
Reply all
Reply to author
Forward
0 new messages