def twoslug_atom(): released = schedule.regular() seed = calendar.timegm(released.timetuple()) link = url_for('twoslug_slugline', seed=seed, _external=True) chooser = random.Random(seed) verb = wordnet.get_verb(chooser=chooser).capitalize() noun = wordnet.get_noun(chooser=chooser).capitalize() slugline = '{0} {1}'.format(verb, noun) feed = AtomFeed('TwoSlug Today', feed_url=request.url, url=request.url_root) feed.add(title=slugline, title_type='text', content=slugline, content_type='text', published=released, updated=released, id=link, url=link, author='TwoSlug') return feed.get_response()
def doge_atom(): released = schedule.regular(offset=6) seed = calendar.timegm(released.timetuple()) link = url_for('doge_poem', seed=seed, _external=True) chooser = random.Random(seed) first = doge.get_verse(chooser=chooser) filter_delimeter = lambda item: item != first[0] second = doge.get_verse(filter_delimeter=filter_delimeter, chooser=chooser) last = doge.get_finale(chooser=chooser) poetry = '{0}\n{1}\n{2}\n'.format(' '.join(first), ' '.join(second), last[0]) feed = AtomFeed('DogPoet Poetry', feed_url=request.url, url=request.url_root) feed.add(title=poetry, title_type='text', content=poetry, content_type='text', published=released, updated=released, id=link, url=link, author='DogePoet') return feed.get_response()