def dumps(entities, previous_page=None, next_page=None, entity_links=True): """Serializes a list of dictionaries as an ATOM feed""" title = unicode(yagi.config.get("event_feed", "feed_title")) feed = PagedFeed( title=title, link=_entity_url(), feed_url=_entity_url(), description=title, language=u"en", previous_page_url=("%s?page=%s" % (_entity_url(), previous_page)) if previous_page is not None else None, next_page_url=("%s?page=%s" % (_entity_url(), next_page)) if next_page is not None else None, ) for entity in entities: _feed_entity(feed, entity, entity_links) return feed.writeString("utf-8")
def dumps(entities, previous_page=None, next_page=None, entity_links=True): """Serializes a list of dictionaries as an ATOM feed""" title = unicode(yagi.config.get('event_feed', 'feed_title')) feed = PagedFeed( title=title, link=_entity_url(), feed_url=_entity_url(), description=title, language=u'en', previous_page_url=("%s?page=%s" % (_entity_url(), previous_page)) if previous_page is not None else None, next_page_url=("%s?page=%s" % (_entity_url(), next_page)) if next_page is not None else None) for entity in entities: _feed_entity(feed, entity, entity_links) return feed.writeString('utf-8')
def dump_item(entity, entity_links=True): """Serializes a single dictionary as an ATOM entry""" from StringIO import StringIO outfile = StringIO() handler = feedgenerator.SimplerXMLGenerator(outfile, 'utf-8') handler.startDocument() title = unicode(yagi.config.get('event_feed', 'feed_title')) feed = PagedFeed( title=title, link=_entity_url(), feed_url=_entity_url(), description=title, language=u'en', previous_page_url=None, next_page_url=None) _feed_entity(feed, entity, entity_links) feed.write_item(handler, feed.items[0], root=True) return outfile.getvalue()
def dump_item(entity, entity_links=True): """Serializes a single dictionary as an ATOM entry""" from StringIO import StringIO outfile = StringIO() handler = feedgenerator.SimplerXMLGenerator(outfile, "utf-8") handler.startDocument() title = unicode(yagi.config.get("event_feed", "feed_title")) feed = PagedFeed( title=title, link=_entity_url(), feed_url=_entity_url(), description=title, language=u"en", previous_page_url=None, next_page_url=None, ) _feed_entity(feed, entity, entity_links) feed.write_item(handler, feed.items[0], root=True) return outfile.getvalue()