bin/make-workshop-rss-feed.py
def build_workshop_rss(config, filename, workshops):
    '''
    Generate RSS2 file for workshops given the metadata blobs for
    recent workshops.
    '''
    site = config['site']
    publish_time = datetime.datetime.now()
    # Create RSS items.
    try:
        items = [ContentEncodedRSSItem(title=bc['venue'],
                                       creator=bc['contact'],
                                       guid=get_guid(site, bc),
                                       link=bc['url'],
                                       description=get_description(bc),
                                       categories=[get_country(site, bc)],
                                       pubDate=publish_time)
                 for bc in workshops]
    except KeyError as e:
        print('Failed to find key {0} in {1}'.format(str(e), bc), file=sys.stderr)
        sys.exit(1)

    # Create RSS feed.
    rss = ContentEncodedRSS2(title='Software Carpentry workshops',
                             description='Helping researchers do more, in less time, with less pain',
                             lastBuildDate=datetime.datetime.utcnow(),
                             link=site,
                             items=items)

    # Save.
    with open(filename, 'w') as writer:
        rss.write_xml(writer)

    Generate RSS2 file for workshops given the metadata blobs for
    recent workshops.
    
Generate RSS2 file for workshops given the metadata blobs for
recent workshops.
Generate RSS2 file for workshops given the metadata blobs for recent workshops .
def build_workshop_rss(config, filename, workshops):
    site = config['site']
    publish_time = datetime.datetime.now()
    try:
        items = [ContentEncodedRSSItem(title=bc['venue'],
                                       creator=bc['contact'],
                                       guid=get_guid(site, bc),
                                       link=bc['url'],
                                       description=get_description(bc),
                                       categories=[get_country(site, bc)],
                                       pubDate=publish_time)
                 for bc in workshops]
    except KeyError as e:
        print('Failed to find key {0} in {1}'.format(str(e), bc), file=sys.stderr)
        sys.exit(1)
    rss = ContentEncodedRSS2(title='Software Carpentry workshops',
                             description='Helping researchers do more, in less time, with less pain',
                             lastBuildDate=datetime.datetime.utcnow(),
                             link=site,
                             items=items)
    with open(filename, 'w') as writer:
        rss.write_xml(writer)
def build_workshop_rss ( config , filename , workshops ) : site = config [ 'site' ] publish_time = datetime . datetime . now ( ) try : items = [ ContentEncodedRSSItem ( title = bc [ 'venue' ] , creator = bc [ 'contact' ] , guid = get_guid ( site , bc ) , link = bc [ 'url' ] , description = get_description ( bc ) , categories = [ get_country ( site , bc ) ] , pubDate = publish_time ) for bc in workshops ] except KeyError as e : print ( 'Failed to find key {0} in {1}' . format ( str ( e ) , bc ) , file = sys . stderr ) sys . exit ( 1 ) rss = ContentEncodedRSS2 ( title = 'Software Carpentry workshops' , description = 'Helping researchers do more, in less time, with less pain' , lastBuildDate = datetime . datetime . utcnow ( ) , link = site , items = items ) with open ( filename , 'w' ) as writer : rss . write_xml ( writer )
Generate RSS2 file for workshops given the metadata blobs for
recent workshops.
Generate RSS2 file for workshops given the metadata blobs for recent workshops .
'''
    Generate RSS2 file for workshops given the metadata blobs for
    recent workshops.
    ''' # Create RSS items. # Create RSS feed. # Save.
config
filename
workshops