#145 — Templates should only use methods/attributes defined on relevant interfaces

by Tim Hicks last modified Jun 05, 2009 08:56 PM
State Resolved
Version: 1.7
Area Functionality
Issue type Bug
Severity Medium
Submitted by Tim Hicks
Submitted on Oct 09, 2008
Responsible
Target release: 1.7
http://dev.plone.org/collective/changeset/61086#file1

I think there's a problem here with the use of "entry/Creator" and "entry/ModificationDate". Neither is defined for the IWeblogEntry interface, which means that it only works with Quills because the Quills WeblogEntry type is AT-based, and thus happens to have those methods.

I would expect that code to fail with QuillsEnabled, although there are no failing tests. Still, I suspect that something is wrong with the behaviour under QuillsEnabled - e.g. displaying the wrong creator, or something.

In general, we can only call methods defined on IWeblog and IWeblogEntry in the skin templates or we lose reusability.
Added by Jan Hackel on Nov 04, 2008 08:30 PM
Issue state: unconfirmedopen
QuillsEnabled does not fail because the views use the WeblogEntryCatalogBrain for displaying, instances of which silently extend AbstractCatalogBrain. The latter provides access to common DC attributes. Nonetheless it is bad style to fall back to those.
Added by Tim Hicks on Dec 16, 2008 05:30 PM
Issue state: openresolved
Added a fix for this in http://dev.plone.org/collective/changeset/77704 .
Added by Jan Hackel on Dec 16, 2008 08:37 PM
By mere chance I was fiddling around with this issue yesterday. Apart from the templates there are various section in the Python code that do not adhere the quills.core protocols. With Products.QuillsEnabled this can be checked quite easily by simply using the actual objects instead of brains. E.g. in the Folder adapter getEntries method one would add something like [IWeblogEntry(x.getObject()) for x in results].

There are references to DC attribute that can be easily fix, but there really nasty ones too. For instance quills.app.utilities.getArchivePathFor refers to getId simply does not for Weblog Entries.

I do not know whether we should strive to make all code adhere to the quills.core protocols.

   
Added by Tim Hicks on Dec 16, 2008 08:43 PM
Issue state: resolvedopen
Re-opening the issue... Hmm, I thought it might be wishful thinking that these would be the last examples of this.

I think we should probably pick off the easy ones that you mention.

As for the lack of an IWeblog.getID method, I wonder if we should actually add that (as well as getTitle). Would that solve all of our problems?
Added by Tim Hicks on Jan 09, 2009 12:25 PM
See http://dev.plone.org/collective/changeset/78679 for a checkin where I add getId and getTitle methods to IWeblog and IWeblogEntry.
Added by Jan Hackel on Apr 27, 2009 02:01 PM
I think we should close this one. It is more a motto than an issue. I see no way to test whether this issue is fixed.
Added by Tim Hicks on Apr 27, 2009 02:07 PM
Issue state: ConfirmedResolved
Agreed.

No responses can be added.