Lines by ppdigital at Morguefile.com

Plone Tweaks: Fixing Folder_Summary_View & Archetype Problems

The shift to Plone 3 has meant that I have had to transfer over skins and other customizations I made from previous versions. For the most part, these have gone pretty cleanly. I noticed two continuing problems, though. One was cosmetic: my home page is a collection and I was using a custom folder_summary_view template. Although you could edit the rich portion of the view, it did not display. The other was more important. A custom type I developed for blogging had not properly updated; any content objects based on it were not being indexed and were showing up in Google Webmaster tools as being 404. I could see the content in the ZMI, but no-one else could!

Fixing the Folder_Summary_View Custom Template

The folder_summary_view problem was simple enough, once I went through the default template in /portal_skins/plone_content/.  I like that the folder_summary_view includes thumbnails.  My tweaks included pulling up the Subjects and turning them into quick search links, so that all posts using that Subject could also be viewed.  So I edited the new version of the template by changing the “Read More” link and inserted the following in the template:

<p class=”tileFooter”>

<a href=””    

tal:attributes=”href python:test(item_type in use_view_action, item_url+’/view’, item_url);”

     i18n:translate=”read_more”>&nbsp;&nbsp;&raquo;&nbsp;&nbsp;Read More&hellip;</a></p>

<p class=”relatedtops”>Related Topics:&nbsp;

<span tal:repeat=”relatedtop item_subject”>

<a href=”#” class=”relatedtops” 

tal:attributes=”href python: ‘/search?Subject=’ + relatedtop”>

<span tal:replace=”relatedtop”>Subject</span></a>                        

</span>

</p>

Then I inserted this line, which had been in my old template, to grab the Subjects for all of the items:

item_subject item/Subject;

in the folderContents block near the top of the template.  This worked in my 2.5 site but did not work in my 3.2 site!  Through a bit of trial and error – and just comparing the other lines in that same block, I changed the line to:

item_subject item/Subject|nothing;

and that worked.

I don’t have any fix for the error that I have seen others get as well

Macro expansion failed exceptions.KeyError: ‘fl_macro’

but it’s a low priority task as the template is working otherwise.

Updating My Blog Content Type

I originally created DBlog Item based on the old News Item.  When I upgraded, a new DBlog Item was created, based on the ATNewsItem content type.  In version 2, as far as I can tell, both content types were accessible.  But the migration to 3 seemed to have broken the ability to view the content made with the original content type.

I compared both under /portal_types and found that there were a number of differences between the two: different Properties pages, different Aliases and Actions, different interfaces.  In the end, it seems to have been the Actions which were the most crucial.  I edited the Actions to change document_view to newsitem_view and the old content type-based documents were now accessible.  I also made the change on the Aliases tab.

Next I took a step which can be filed under “Dumb” or, alternatively, “Curiousity”.  In any event, I went into the Archetype tool (/archetype_tool) and selected the Update Schema tab, clicked the box next to ATNewsItem, selected the drop down box at the bottom for updating only objects with old schemas, and ran an update.