Beispiel #1
0
def stumbl():
    userid = request.form['prompt']
    tags = request.form['interests']
    if userid == '':
        return render_template('index.html', user = '', tag = '', url='http://tumblr.com')
    tags = tags.split(',')

    if " separated by commas" in tags and len(mongoFunctions.get_tags(userid)) <= 1:
        tags = ['hacking']
    for i in range(0,len(tags)):
        tags[i] = tags[i].strip()

    try:
        for tag in backend.retrieveLikes(userid):
            tags.append(tag)
    except urllib2.HTTPError:
        tags = tags

    mongoFunctions.insert_user(userid, tags)
    mongoFunctions.update_tags(userid, tags, 0)
    url, tag = backend.getUrl(mongoFunctions.get_tags(userid), userid)
    mongoFunctions.add_to_recently_visited(userid, url)
    favList = mongoFunctions.get_favorites(userid)
    return render_template('index.html', url = url, tag = tag, user = userid, favorites = favList)
Beispiel #2
0
def stumbl():
    mongoFunctions.insert_user(25, {})
    url = backend.getUrl({"Guitar": 5, "Pennapps": 20, "Shred": 6, "HackRU": 2}, 25)