[Framework-Team] [PLIP144 Next/Previous] - Background and observations

Alec Mitchell apm13 at columbia.edu
Sun Sep 3 18:18:53 UTC 2006


On 9/3/06, Martin Aspeli <optilude at gmx.net> wrote:
> Hi guys,
>
> Since we need to get going, I thought I'd start with an easy one.
>
> 1. Overview
> ===========
>
> PLIP144 - Generalised Next/Previous Navigation, aims to make it easier
> to navigate between items in a folder. The typical use case is a folder
> full of photos, where you want to be able to go to the next or previous
> photo without having to go up to a folder listing.
...
> 5. How does it work
> ===================
>
> CMFPlone.browser.interfaces.INextPreviousProvider looks like this:
>
> class INextPreviousProvider(Interface):
>      """A folderish component capable of describing the next and previous
>      item relative to a particular id.
>      """
>
>      def getNextItem(oid):
>          """Returns the next item in the container
>
>          oid is the id of the current object being viewed.
>          """
>
>      def getPreviousItem(oid):
>          """Returns the previous item in the container
>
>          oid is the id of the current object being viewed.
>          """
>
>      def isNextPreviousEnabled():
>          """Checks if the container has next / previous navigation
> enabled"""
>
> There is a general adapter from ATFolder to INextPreviousProvider which
> can get the next and previous item in a folder. The 'enabled' status
> comes from a new field in the ATFolder schema, found in
> ATContentTypes.content.schemata.NextPreviousAwareSchema.

I would suggest that a pattern using a multi-adapter on context and
the folder might be a bit more flexible.  In particular for the case
of something like a smartfolder, where the id of the object may not be
sufficiently unique to determine which entry is being looked at.
Also, generally speaking when you have an adapter for which nearly
every method takes an argument that is related to some other object,
it is likely that what you want is a multi-adapter.  Otherwise this is
a great feature and the implementation I saw of it at the sprint
seemed (superficially at least) quite lovely.

Alec




More information about the Framework-Team mailing list