예제 #1
0
def render_portal(self, h, comp, *args):
    with h.rss(version='0.91'):
        with h.channel:
            h << h.title(APP_TITLE)
            h << h.link(get_url_service().base_url)
            h << h.description(_('Ideas'))

            for idea in get_all_published_ideas().limit(10):
                with h.item:
                    h << h.title(idea.title)
                    h << h.link(get_url_service().expand_url(['idea', idea.id], relative=False))
                    h << h.description(idea.description)
                    h << h.pubDate(idea.publication_date.strftime('%a, %d %b %Y %H:%M:%S'))

    return h.root
예제 #2
0
def render_portal_xml_published_ideas(self, h, comp, *args, **kw):
    ir = IdeaRepository()
    with h.ideas:
        for idea in get_all_published_ideas().limit(10):
            with h.idea:
                h << h.title(idea.title)
                h << h.description(idea.description)
                # The author is not available in the idea result
                i = ir.get_by_id(idea.id)
                user_data = i.authors[0] if i.authors else None
                # We must wrap it with the heavyweight User class to access the photo_url
                user = User(None, user_data.uid)
                with h.author:
                    h << h.uid(user.uid)
                    h << h.lastname(user.user.lastname)
                    h << h.firstname(user.user.firstname)
                    h << h.avatar(user.photo_url)
    return h.root