rfeed icon indicating copy to clipboard operation
rfeed copied to clipboard

Items printed as "[[...]]"

Open tbowers opened this issue 7 years ago • 1 comments

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())

tbowers avatar Oct 17 '17 04:10 tbowers

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

darcosion avatar Jul 29 '21 12:07 darcosion