示例#1
0
def all_posts():
    items = get_all_items(g.db_file)
    return Response(dumps(items), mimetype="application/json")
示例#2
0
channel_image_link = SubElement(channel_image, 'link')
channel_image_width = SubElement(channel_image, 'width')
channel_image_height = SubElement(channel_image, 'height')

channel_title.text = channel_image_title.text = 'UCLL Nieuwsberichten'
channel_description.text = 'UC Leuven-Limburg : Nieuwsberichten'
channel_link.text = channel_image_link.text = 'https://intranet.ucll.be'
channel_language.text = 'nl-be'
channel_copyright.text = 'Copyright UC Leuven-Limburg'
channel_publish_date.text = date_to_rfc822(datetime.now())
channel_generator.text = 'https://github.com/DavidOpDeBeeck/UCLL-Intranet-RSS'
channel_image_url.text = 'https://www.ucll.be/sites/all/themes/balance_theme/apple-touch-icon-precomposed-57x57.png'
channel_image_width.text = channel_image_height.text = '57'


for index, item in enumerate(database.get_all_items()):
    if index == 0:
        channel_last_build_date.text = date_to_rfc822(datetime.fromtimestamp(int(item['pubDate'])))
    channel_item = SubElement(channel, 'item')
    channel_item_title = SubElement(channel_item, 'title')
    channel_item_link = SubElement(channel_item, 'link')
    channel_item_description = SubElement(channel_item, 'description')
    channel_item_guid = SubElement(channel_item, 'guid')
    channel_item_publish_date = SubElement(channel_item, 'pubDate')
    channel_item_author = SubElement(channel_item, 'author')

    channel_item_title.text = item['title']
    channel_item_link.text = channel_item_guid.text = item['guid']
    channel_item_description.text = format_text(item['description'])
    channel_item_publish_date.text = date_to_rfc822(datetime.fromtimestamp(int(item['pubDate'])))
    channel_item_author.text = item['author']
示例#3
0
def all_posts():
    items = get_all_items(g.db_file)
    return Response(dumps(items), mimetype="application/json")