AddGuidToTimelineFeedPatch for Trac

Description:

This patch adds a guid (global unique identifier) element to the Timeline RSS feed of Trac.

Example:

Thunderbird 1.5.x - and maybe other RSS feed readers, too - use the link element for identifying feed items (i.e. for storing feed items and for detecting duplicate entries). This may lead to problems if the RSS feed contains multiple entries with the same link, for example in case of a RSS feed reporting updates of web sites (e.g. changes to the Trac wiki). Providing each feed item with a guid (global unique identifier) element may help the RSS feed readers to identify individual feed items.

Please Note: As it turned out, Thunderbird 1.5.x does not evaluate the guid element even if it's there. To make Thunderbird 1.5.x do so, install this extension patch.

The following changes have been made to Trac version 0.9.6. (PS: Be careful about the indentation level of each statement because Python's blocking scheme is based on indentation!!)

How to add a guid element to each feed item of the Trac Timeline RSS feed

In .../python/site-packages/trac/Timeline.py, find the following lines:

             if format == 'rss':
                 # Strip/escape HTML markup
                 event['title'] = rss_title(title)
                 event['message'] = str(message)

and append the following statements beneath them:

                import md5
                event['guid'] = md5.new(href + str(date)).hexdigest()

Furthermore, find the following tag (possibly followed by <?cs...) in .../share/trac/templates/timeline_rss.cs

   </item>

and prepend the following line above it:

    <guid isPermaLink="false"><?cs var:event.guid ?></guid>

Or just patch Timeline.diff and timeline_rss.diff to your Trac installation (applicable to Trac version 0.9.6):

  1. Copy the Timeline.diff file into the .../python/site-packages/trac/ directory of your Trac installation (version 0.9.6!)
  2. At your shell prompt, type in "patch .../python/site-packages/trac/Timeline.py .../python/site-packages/trac/Timeline.diff"
  3. Copy the timeline_rss.diff file into the .../share/trac/templates/ directory of your Trac installation (version 0.9.6!)
  4. At your shell prompt, type in "patch .../share/trac/templates/timeline_rss.cs .../share/trac/templates/timeline_rss.diff"
  5. Done!