Re: A simple question about ordering of posts
chombee <[email protected]> Tue, 2 Feb 2010 10:20:10 +0000
| Newsgroups | gmane.comp.web.pyblosxom.user |
|---|---|
| Message-ID | <20100202102010.GA6286@dulip> |
On Mon, Feb 01, 2010 at 06:14:50PM -0500, will kahn-greene wrote:
>
> Say I only wanted to do this if PyBlosxom is rendering a category index
> and not a specific entry. I'd do something like this:
>
> def cb_prepare(args):
> # only thing in the args dict is the request object
> request = args["request"]
>
> # the entry list is in the data section
> data = request.get_data()
>
> entrylist = data["entry_list"]
>
> if data["bl_type"] = "dir" and len(entrylist) > 0:
> first_entry = entrylist[0]
> first_entry["template_name"] = "story_big_size"
>
So it looks like to change the template for every entry that is about to
be rendered you'd have to iterate over entries, something like:
def cb_prepare(args):
request = args['request']
data = request.get_data()
if data['bl_type'] == 'dir':
entrylist = data['entry_list']
for entry in entrylist:
entry['template_name'] = 'story-index'
(Assuming the entries come as dictionaries like that, but you get the
idea.)
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com