#121 — Quills default item behaviour in Plone3

by Justin Ryan last modified Jan 08, 2009 04:05 PM
State Resolved
Version: 1.6
Area Functionality
Issue type Bug
Severity Important
Submitted by Justin Ryan
Submitted on Nov 05, 2007
Responsible Justin Ryan
Target release: 1.6
Tags:
Howdy..

I've just begun to set up a new weblog using the released Plone3, or whatever is in the egg my buildout finds, at least, and am having an issue when setting my Weblog as the default item in the portal, after adding it to the relevant list in portal_properties/site_properties:

Time 2007/11/05 11:19:05.284 US/Central
User Name (User Id) admin (admin)
Request URL http://bitmonk.net:7080/[…]/weblog_view
Exception Type AttributeError
Exception Value 'NoneType' object has no attribute 'Title'

Traceback (innermost last):

    * Module ZPublisher.Publish, line 119, in publish
    * Module ZPublisher.mapply, line 88, in mapply
    * Module ZPublisher.Publish, line 42, in call_object
    * Module Products.Five.browser.metaconfigure, line 417, in __call__
    * Module Shared.DC.Scripts.Bindings, line 313, in __call__
    * Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
    * Module Products.PageTemplates.PageTemplateFile, line 129, in _exec
    * Module Products.PageTemplates.PageTemplate, line 89, in pt_render
    * Module zope.pagetemplate.pagetemplate, line 117, in pt_render
    * Module zope.tal.talinterpreter, line 271, in __call__
    * Module zope.tal.talinterpreter, line 346, in interpret
    * Module zope.tal.talinterpreter, line 891, in do_useMacro
    * Module zope.tal.talinterpreter, line 346, in interpret
    * Module zope.tal.talinterpreter, line 536, in do_optTag_tal
    * Module zope.tal.talinterpreter, line 521, in do_optTag
    * Module zope.tal.talinterpreter, line 516, in no_tag
    * Module zope.tal.talinterpreter, line 346, in interpret
    * Module zope.tal.talinterpreter, line 957, in do_defineSlot
    * Module zope.tal.talinterpreter, line 346, in interpret
    * Module zope.tal.talinterpreter, line 536, in do_optTag_tal
    * Module zope.tal.talinterpreter, line 521, in do_optTag
    * Module zope.tal.talinterpreter, line 516, in no_tag
    * Module zope.tal.talinterpreter, line 346, in interpret
    * Module zope.tal.talinterpreter, line 861, in do_defineMacro
    * Module zope.tal.talinterpreter, line 346, in interpret
    * Module zope.tal.talinterpreter, line 534, in do_optTag_tal
    * Module zope.tal.talinterpreter, line 516, in no_tag
    * Module zope.tal.talinterpreter, line 346, in interpret
    * Module zope.tal.talinterpreter, line 745, in do_insertStructure_tal
    * Module zope.tales.tales, line 696, in evaluate
      URL: file:/home/zope/qutang-plone30/parts/plone30/CMFPlone/skins/plone_templates/main_template.pt
      Line 103, Column 18
      Expression: <StringExpr u'plone.contentviews'>
      Names:

      {'container': <Weblog at /sites/bitmonk.net/quillsonly/blog>,
       'context': <Weblog at /sites/bitmonk.net/quillsonly/blog>,
       'default': <object object at 0xb7f76528>,
       'here': <Weblog at /sites/bitmonk.net/quillsonly/blog>,
       'loop': {},
       'nothing': None,
       'options': {'args': (<Products.Five.metaclass.SimpleViewClass from /home/zope/qutang-plone30/src/quills.app/quills/app/browser/weblog_view.pt object at 0xb1ee588c>,)},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xb1ee55ac>,
       'request': <HTTPRequest, URL=http://bitmonk.net:7080/[…]/weblog_view>,
       'root': <Application at >,
       'template': <ImplicitAcquirerWrapper object at 0xb1ee53ec>,
       'traverse_subpath': [],
       'user': <PropertiedUser 'admin'>,
       'view': <Products.Five.metaclass.SimpleViewClass from /home/zope/qutang-plone30/src/quills.app/quills/app/browser/weblog_view.pt object at 0xb1ee588c>,
       'views': <zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object at 0xb1ee544c>}

    * Module Products.Five.browser.providerexpression, line 37, in __call__
    * Module plone.app.viewletmanager.manager, line 140, in render
    * Module Shared.DC.Scripts.Bindings, line 313, in __call__
    * Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
    * Module Products.PageTemplates.PageTemplateFile, line 129, in _exec
    * Module Products.PageTemplates.PageTemplate, line 89, in pt_render
    * Module zope.pagetemplate.pagetemplate, line 117, in pt_render
    * Module zope.tal.talinterpreter, line 271, in __call__
    * Module zope.tal.talinterpreter, line 346, in interpret
    * Module zope.tal.talinterpreter, line 855, in do_condition
    * Module zope.tal.talinterpreter, line 346, in interpret
    * Module zope.tal.talinterpreter, line 536, in do_optTag_tal
    * Module zope.tal.talinterpreter, line 521, in do_optTag
    * Module zope.tal.talinterpreter, line 516, in no_tag
    * Module zope.tal.talinterpreter, line 346, in interpret
    * Module zope.tal.talinterpreter, line 534, in do_optTag_tal
    * Module zope.tal.talinterpreter, line 516, in no_tag
    * Module zope.tal.talinterpreter, line 346, in interpret
    * Module zope.tal.talinterpreter, line 745, in do_insertStructure_tal
    * Module zope.tales.tales, line 696, in evaluate
      URL: contentactions
      Line 31, Column 8
      Expression: <StringExpr 'plone.contentmenu'>
      Names:

      {'container': <Weblog at /sites/bitmonk.net/quillsonly/blog>,
       'context': <Weblog at /sites/bitmonk.net/quillsonly/blog>,
       'default': <object object at 0xb7f76528>,
       'here': <Weblog at /sites/bitmonk.net/quillsonly/blog>,
       'loop': {},
       'nothing': None,
       'options': {'args': ()},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xb125b04c>,
       'request': <HTTPRequest, URL=http://bitmonk.net:7080/[…]/weblog_view>,
       'root': <Application at >,
       'template': <ImplicitAcquirerWrapper object at 0xb115c1ec>,
       'traverse_subpath': [],
       'user': <PropertiedUser 'admin'>,
       'view': <Products.Five.viewlet.metaconfigure.ContentActionsViewlet object at 0xb115cdac>,
       'views': <zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object at 0xb125bb2c>}

    * Module Products.Five.browser.providerexpression, line 37, in __call__
    * Module Shared.DC.Scripts.Bindings, line 313, in __call__
    * Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
    * Module Products.PageTemplates.PageTemplateFile, line 129, in _exec
    * Module Products.PageTemplates.PageTemplate, line 89, in pt_render
    * Module zope.pagetemplate.pagetemplate, line 117, in pt_render
    * Module zope.tal.talinterpreter, line 271, in __call__
    * Module zope.tal.talinterpreter, line 346, in interpret
    * Module zope.tal.talinterpreter, line 586, in do_setLocal_tal
    * Module zope.tales.tales, line 696, in evaluate
      URL: contentmenu
      Line 1, Column 0
      Expression: <PathExpr standard:'view/menu'>
      Names:

      {'container': <Weblog at /sites/bitmonk.net/quillsonly/blog>,
       'context': <Weblog at /sites/bitmonk.net/quillsonly/blog>,
       'default': <object object at 0xb7f76528>,
       'here': <Weblog at /sites/bitmonk.net/quillsonly/blog>,
       'loop': {},
       'nothing': None,
       'options': {'args': ()},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xb101f86c>,
       'request': <HTTPRequest, URL=http://bitmonk.net:7080/[…]/weblog_view>,
       'root': <Application at >,
       'template': <ImplicitAcquirerWrapper object at 0xaf95ddcc>,
       'traverse_subpath': [],
       'user': <PropertiedUser 'admin'>,
       'view': <plone.app.contentmenu.view.ContentMenuProvider object at 0xb103138c>,
       'views': <zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object at 0xb101f2cc>}

    * Module zope.tales.expressions, line 217, in __call__
    * Module Products.PageTemplates.Expressions, line 161, in _eval
    * Module Products.PageTemplates.Expressions, line 123, in render
    * Module plone.app.contentmenu.view, line 41, in menu
    * Module zope.app.publisher.browser.menu, line 66, in getMenuItems
    * Module zope.app.publisher.browser.menu, line 176, in getMenu
    * Module plone.app.contentmenu.menu, line 294, in getMenuItems

AttributeError: 'NoneType' object has no attribute 'Title'
Steps to reproduce:
Install Plone3, Quills 1.6/trunk
Create a new site, select quills.app and Products.Quills in extension profile list
Create a weblog
Publish it
Create a weblog entry
Publish it
Surf to portal_properties/site_properties of ZMI, add Weblog to default_page_types lines field, save
Surf to home of portal, use "display" menu to change content item as default view TTP
select the weblog you created
observe above error, unless I've done something wrong. :)
Added by Tim Hicks on Nov 06, 2007 12:02 AM
Responsible manager: justizin(UNASSIGNED)
Does this help? quills-dev@lists.etria.com/msg01644.html" rel="nofollow">http://www.mail-archive.com/[…]/msg01644.html
Added by (anonymous) on Nov 15, 2007 11:37 AM
Works fine with:
Plone 2.5.3-final,
CMF-1.6.4,
Zope (Zope 2.9.7-final, python 2.4.4, win32),
Five 1.3.8,
Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)],
PIL 1.1.5

Quills 1.5.0-RC3
Added by Justin Ryan on Nov 15, 2007 04:22 PM
Responsible manager: (UNASSIGNED)justizin
Tim - I can't follow the link you've posted..

Anonymous (maybe tim?) - I note that you can't reproduce this and will try to make sure my setup fits your environment as closely as possible.

Thanks!

J
Added by Justin Ryan on Nov 15, 2007 04:25 PM
Issue state: unconfirmedopen
Whup, I didn't read the entire Anonymous comment, which isn't quite relevant here, because I know that Quills and Plone 2.5 have no trouble with weblog-as-default-item, but Plone3 and newer Quills seem to.
Added by Justin Ryan on Dec 17, 2007 07:43 AM
Issue state: openin-progress
It turns out this only happens when logged in, as I have a site which is working fine for anonymous.

I'd really like to see this addressed, and of course, I want to help however I can.

Maybe this has something to do with the default view not being a multiadapter - it sort of looks like the content menus are looking for a view which is None. In this site, Weblog is the only type other than Topic which is listed, so that would make sense.

Is there room on trunk for viewification work right now, or should I cut a branch?
Added by Justin Ryan on Dec 17, 2007 08:16 AM
Whups, my mistake..

This doesn't happen for all logged-in users - only those with ability to edit or post to the weblog, i suppose.
Added by Raphael Ritz on Dec 17, 2007 09:38 AM
Almost certainly this is due to

  https://dev.plone.org/plone/ticket/7226

If so, I would consider it Plone's fault - not Quills.

Raphael
Added by Raphael Ritz on Dec 19, 2007 09:24 AM
As work-around for the time being we might try to include the
BrowserDefaultMixin class in the weblog definition. Something like:

from Products.CMFDynamicViewFTI.browserdefault import BrowserDefaultMixin

...

class Weblog(WeblogMixin, BrowserDefaultMixin, BaseFolder):
...

in Quills.Weblog might do it.

Sorry for not testing this myself right away :-(

Raphael
Added by (anonymous) on Dec 19, 2007 01:51 PM
What Raphaels suggested works. Also what Tim suggested over in ticket #6 [1]. I would lean towards what tim suggested in doing the following:

implements(IWeblog, ISelectableBrowserDefault)

The problem with either solution is that Plone still does not act properly when this is set up. First you have to modify the 'select_default_page' template to remove the condition on item.isfolderish (if you want to select the item and not name it FrontPage, etc.):

items python:[item for item in here.getFolderContents() if not item.is_folderish or item.portal_type in availableTypes];

Other issues here the content bar. The add menu shows the items for the root of the site and not the blog you are on. The folder_contents tab shows the contents for the root of the site. Everything else seems to function properly.

I don't think this issue is a blocker for the 1.6 (or 1.5 release). I think we need to push more on Plone for this to be resolved correctly. We can cook up a recipe for people to follow to add this functionality if they want it in the meantime.

claytron

[1] http://plone.org/products/quills/issues/6
Added by Justin Ryan on Dec 19, 2007 07:08 PM
Howdy Clayton!

Thanks for speaking up!

I disagree that you don't think this is a blocker, because this functionality has always worked in Quills. The content bar is an issue that does need to be resolved in Plone, but there is not a clear solution to it if you ask me, and the Quills admin portlet allows one to continue adding weblog entries without the 'add' menu. I'd really like to not see this functionality regress, because it allows us to compete better with pure weblogging solutions like WordPress.

Also, I have never had to edit the select_default_page template - it's designed already to allow you to select Topic as default, and if you go to portal_properties/site_properties, you can add Weblog to default_page_types, and bada-bing, you're in business. This works fine already, but after changing the default item to a weblog, that weblog fails to render for anyone with Owner / Manager.

I don't think we should need to push a "recipe", which sounds like a fancy name for a patch, when we can just implement a couple of lines of code, and a comment pointing at a Plone bug that our community should be especially interested in chasing down.

I do think that cutting a release which removes long-supported functionality would be worse than simply not breaking from the time-honored tradition of running Quills from trunk. Sure, I'd prefer a release, but I'd prefer it not throw away features in such a way that may be used as a precedent by future maintainers to say this feature is not important at all.

Release management is about consistency, not fools rushing in. :)
Added by Justin Ryan on Dec 20, 2007 04:12 AM
Issue state: in-progressresolved
This is in trunk, since Tim seems comfortable in #6 with the idea of someone else implementing this:

  http://dev.plone.org/collective/changeset/55948

I also committed a subsequent changeset with a comment pointing at this issue, #6 in Quills, and the aforementioned Plone issue.

No responses can be added.

Filed under: