Re: Pyblosxom permalinks are not permanent

Steve Hoelzer <[email protected]> Thu, 10 Sep 2009 09:03:00 -0500
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
On Wed, Sep 9, 2009 at 4:23 PM, will <[email protected]> wrote:
> Steve Hoelzer wrote:
>> It also seems wasteful to render some pages twice (ex:
>> /2009/index.html). It would be nice to detect the duplicates and get
>> rid of them.
>
> If you can implement this, feel free to do so and send in a patch.

I'm not sure if you care about the order that pages are rendered. If
not, here's a simple solution. At the end of the "walk" function,
instead of this:

    return _walk_internal(root, recurse, pattern, ignorere, return_folders)

Use sorted(set(...)) like this:

    return sorted(set(_walk_internal(root, recurse, pattern, ignorere,
return_folders)))

Or make it explicit:

    result = _walk_internal(root, recurse, pattern, ignorere, return_folders)
    result = sorted(set(result)) # remove duplicates from list
    return result

Steve

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july