Rather than use use gluon.serializers.rss, I am using
gluon.contrib.rss2 to attempt to add an enclosure to an rss feed:

http://code.google.com/p/publicradioroadtrip/source/browse/controllers/default.py?spec=svnd020b7842a1c0a9ba880fb5f94146bbb5ab55524&r=d020b7842a1c0a9ba880fb5f94146bbb5ab55524#590

    for story in stories:

        x = {}
        enclosure = {'url': story.audio_url, 'length': '0', 'type':
'audio/mpeg'}
        title = story.title
        link = story.url
        # enclosure = story.audio_url
        description = story.description
        comments = 'test'
        created_on = request.now
        x.update(title=title, link=link, enclosure=enclosure,
description=description, comments=comments, created_on=created_on)
        entries.append(x)

    rss = rss2.RSS2(title=collection.title,
        link = scheme + '://' + request.env.http_host +
request.env.path_info,
        description = collection.description,
        lastBuildDate = request.now,
        items = [
            rss2.RSSItem(title = entry['title'],
                link = entry['link'],
                description = entry['description'],
                comments = entry['comments'],
                # enclosure = entry['enclosure'],
                pubDate = request.now) for entry in entries])

    response.headers['Content-Type']='application/rss+xml'
    return rss2.dumps(rss)

However, i am running into an issue where I am recieving the error:

AttributeError: 'dict' object has no attribute 'publish'

http://pastie.textmate.org/1796751

I copied some additional information here.

http://pastie.textmate.org/1796758

In looking line 310 in contrib.rss2, it appears that enclosure should
contain a dictionary, but I could be wrong:

    def publish(self, handler):
        _element(handler, 'enclosure', None,
            {'url': self.url, 'length': str(self.length), 'type':
self.type})

Any suggestions you might have about getting this to work are most
appreciated.

Reply via email to