2

I'm using PyRSS2Gen to generate a RSS feed and I'm trying to support PubSubHubbub, but I need to add link elements that break RSS. Here's what should work without requiring a rewrite as Atom:

<atom:link rel="hub" href="http://example.hub.com" xmlns:atom="http://www.w3.org/2005/Atom">
<atom:link rel="self" href="http://example.com" xmlns:atom="http://www.w3.org/2005/Atom">

Can I add arbitrary XML in PyRSS2Gen somehow? I don't think element_attrs or rss_attrs are enough to accomplish this, or are they? PyRSS2Gen.RSS2() expects at most 1 link element, so how can I do this?

Thank you,

Kimball

kbighorse
  • 389
  • 1
  • 2
  • 15

1 Answers1

0

I looked at the PyRSS2Gen source code, and it looks like all you have to do is override the RSS class' publish_extensions() method. Something like this perhaps:

import PyRSS2Gen

class MyRSS2(PyRSS2Gen.RSS2):
    def publish_extensions(self, handler):
        PyRSS2Gen._element(handler, 'atom:link', None, {'element': 'attributes here'})

Then use MyRSS2 instead of PyRSS2Gen.RSS2. That's untested code, I recommend checking it before putting it in production, wink.

Kurt McKee
  • 1,410
  • 13
  • 17