creating a chronological folder listing

3 messages Options
Embed this post
Permalink
David Hostetler () creating a chronological folder listing
Reply Threaded More More options
Print post
Permalink
I'm looking for some advice about how to approach the following problem I have related to a theme product I'm developing:

I need to display folder contents sorted by publication date, which would be easy enough, except that I need creation date to be used in the event that an object does not have a publication date.

What's the best way to tackle this?  I can't just deal with the subset of stuff that getFolderContents() returns, because that's already had batching applied, so I wouldn't be dealing with the full set of folder contents, and I don't want to just turn batching off.

If I didn't know better I'd say that I need a special catalog index that is equivalent to: (effective_date or creation_date).  If that existed for all objects, then I could just let the normal getFolderContents() function do its magic by ensuring that I give it a {'sort_on':'effective_or_creation_date'} as the contentFilter.

Any other ideas?

And if not - what's the plone3 best practice for creating a new catalog index?


thanks,

-David Hostetler

_______________________________________________
Product-Developers mailing list
[hidden email]
http://lists.plone.org/mailman/listinfo/product-developers
Gilles Lenfant () Re: creating a chronological folder listing
Reply Threaded More More options
Print post
Permalink
Le 24 juin 09 à 21:36, David Hostetler a écrit :

> I'm looking for some advice about how to approach the following  
> problem I have related to a theme product I'm developing:
>
> I need to display folder contents sorted by publication date, which  
> would be easy enough, except that I need creation date to be used in  
> the event that an object does not have a publication date.
>
> What's the best way to tackle this?  I can't just deal with the  
> subset of stuff that getFolderContents() returns, because that's  
> already had batching applied, so I wouldn't be dealing with the full  
> set of folder contents, and I don't want to just turn batching off.
>
> If I didn't know better I'd say that I need a special catalog index  
> that is equivalent to: (effective_date or creation_date).  If that  
> existed for all objects, then I could just let the normal  
> getFolderContents() function do its magic by ensuring that I give it  
> a {'sort_on':'effective_or_creation_date'} as the contentFilter.
>
> Any other ideas?

Hi,

Plone 3.3 ships with plone.indexer that addresses this kind of use  
case. It may or may not (untested by myself) work with older Plone 3.x.

http://plone.org/products/plone/roadmap/239
http://pypi.python.org/pypi/plone.indexer/

HTH
--
Gilles Lenfant


_______________________________________________
Product-Developers mailing list
[hidden email]
http://lists.plone.org/mailman/listinfo/product-developers
David Hostetler () Re: creating a chronological folder listing
Reply Threaded More More options
Print post
Permalink
Thanks Gilles.  I will look into that.

For the time being, I just added a new script to my theme product that mimics getFolderContents(), but does the date sorting that I described, and made a corresponding template to leverage it (and do some custom formatting).  The only downside is that I can't readily just apply this to collection objects, since they have their own query implementation.  I'm still thinking about how to handle things for collections.

-David

On Thu, Jun 25, 2009 at 05:57, Gilles Lenfant <[hidden email]> wrote:
Le 24 juin 09 à 21:36, David Hostetler a écrit :


I'm looking for some advice about how to approach the following problem I have related to a theme product I'm developing:

I need to display folder contents sorted by publication date, which would be easy enough, except that I need creation date to be used in the event that an object does not have a publication date.

What's the best way to tackle this?  I can't just deal with the subset of stuff that getFolderContents() returns, because that's already had batching applied, so I wouldn't be dealing with the full set of folder contents, and I don't want to just turn batching off.

If I didn't know better I'd say that I need a special catalog index that is equivalent to: (effective_date or creation_date).  If that existed for all objects, then I could just let the normal getFolderContents() function do its magic by ensuring that I give it a {'sort_on':'effective_or_creation_date'} as the contentFilter.

Any other ideas?

Hi,

Plone 3.3 ships with plone.indexer that addresses this kind of use case. It may or may not (untested by myself) work with older Plone 3.x.

http://plone.org/products/plone/roadmap/239
http://pypi.python.org/pypi/plone.indexer/

HTH
--
Gilles Lenfant



_______________________________________________
Product-Developers mailing list
[hidden email]
http://lists.plone.org/mailman/listinfo/product-developers