filelist, sortlist and truncatelist in PyBlosxom 2.0

will <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.devel
Message-ID <[email protected]>
I made some changes in the trunk to fix some problems I was having with
static rendering the web-site.  I added two new callbacks (one was
actually added a while back, but I reimplemented it): sortlist and
truncatelist.

sortlist takes an entry list and returns a sorted entry list.  The
default sort is on mtimes from newest to oldest.

truncatelist takes an entry list and returns a truncated entry
list--specifically a list of the entries that will be rendered.  The
default truncate slices the list based on the config num_entries variable.

Both sortlist and truncatelist get called by the
blosxom_file_list_handler which is the default filelist handler.  If you
have a plugin which implements the filelist callback, then your filelist
callback is responsible for sorting and truncating.  The easiest thing
to do is turn around and call the sortlist and truncatelist callbacks
just like in the blosxom_file_list_handler.

I really like this new setup.  It makes it really easy to write filelist
plugins without having to do weird things with the num_entries config
variable.  For example, implementing a paging plugin is now trivial by
implementing the truncatelist callback.  I re-worked my wbgpager plugin
to do that.  Definitely worth looking at for seeing how the pieces fit
together.

I updated the specification here:

http://pyblosxom.sourceforge.net/wiki/index.php/Filelist_and_sorting_specification

This was a piece I wanted to get done for 2.0 but hadn't really settled 
on an implementation until today.  One less thing to do now.  w00t!

I'm definitely interested in thoughts on this implementation.  I doubt
that it solves all problems, but I think it's a good api for handling
most problems.  If there are use cases out there that don't work with 
this implementation, let me know.

/will

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.