|
From: Steve H. <sho...@gm...> - 2009-09-10 15:08:13
|
On Thu, Sep 10, 2009 at 9:03 AM, Steve Hoelzer <sho...@gm...> wrote:
> On Wed, Sep 9, 2009 at 4:23 PM, will <wi...@bl...> 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)))
Umm, nope. This is wrong. That only applies to the categories and
doesn't check if date archives result in an identical path.
The real fix is to use sorted(set(...)) on 'renderme' near the end of
runstaticrenderer(). The middle lines are new:
print "building %s files." % len(renderme)
# date archives and categories may give identical paths, so remove
duplicates
renderme = sorted(set(renderme))
for url, q in renderme:
Steve
|