svpino / rfeed

Extensible RSS 2.0 Feed Generator written in Python
MIT License
185 stars 41 forks source link

Items printed as "[[...]]" #13

Open tbowers opened 6 years ago

tbowers commented 6 years ago

The examples provided on the main page work fine for me. However they are based on building your items up individually and then passing them into the feed.

In my case I am walking a folder structure and building an items list. I think my modification is very straight forward however when I print the rss, I end up with "[[...]]" instead of my actual serialized items.

   share_urls = get_urls()
    items = []
    for share_url in share_urls:
        itunes_item = iTunesItem(
            author = author,
            image = logo_url,
            explicit = "yes",
            subtitle = "Test Subtitle",
            summary = description)

        item = Item(
                title = title,
                link = homepage,
                description = description,
                author = author,
                guid = Guid(homepage),
                pubDate = datetime.datetime(2014, 12, 29, 10, 00),
                enclosure = Enclosure(url=share_url, length=0, type=''),
                extensions = [itunes_item])

        items.append(items)

    itunes = iTunes(
        author = author,
        subtitle = description,
        summary = description,
        image = logo_url,
        explicit = "yes",
        owner = iTunesOwner(name = author, email = email))

    feed = Feed(
            title = title,
            link = homepage,
            description = description,
            language = "en-US",
            lastBuildDate = datetime.datetime.now(),
            items = [ Item(items) ], # <<<--- I feel like my main issue is here but I'm not sure what I'm doing wrong
            extensions = [itunes])

    print(feed.rss())
darcosion commented 3 years ago

Hello,

feed take in parameter items a list of items. the variable items is a type list. So you send a list of item surrounded by []. I think it will work better with items = items,. :-)

Kindly