Esempio n. 1
0
def twoslug_index():
    chooser = get_chooser()
    verb = wordnet.get_verb(chooser=chooser)
    mode = request.args.get('mode', None)
    if mode == 'alliteration':
      filter_fn = lambda item: item.startswith(verb[0])
    else:
      filter_fn = None
    noun = wordnet.get_noun(filter_fn, chooser=chooser)
    return twoslug_page(verb, noun)
Esempio n. 2
0
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()
Esempio n. 3
0
def twoslug_slugline(seed):
    chooser = random.Random(seed)
    verb = wordnet.get_verb(chooser=chooser)
    noun = wordnet.get_noun(chooser=chooser)
    return twoslug_page(verb, noun)