Ejemplo n.º 1
0
def site_feed():
    topics, _ = get_all_topics()
    title = current_app.config.get('SITE_NAME')
    web_url = canonical_url('front.home')
    self_url = canonical_url('.site_feed')
    xml = u''.join(yield_feed(title, web_url, self_url, topics))
    key = 'feed:xml:%s' % request.path
    cache.set(key, xml, ONE_HOUR)
    return Response(xml, content_type='text/xml; charset=UTF-8')
Ejemplo n.º 2
0
def site_feed():
    topics, _ = get_all_topics()
    title = current_app.config.get('SITE_NAME')
    web_url = canonical_url('front.home')
    self_url = canonical_url('.site_feed')
    xml = u''.join(yield_feed(title, web_url, self_url, topics))
    key = 'feed:xml:%s' % request.path
    cache.set(key, xml, ONE_HOUR)
    return Response(xml, content_type='text/xml; charset=UTF-8')
Ejemplo n.º 3
0
def home():
    topics, _ = get_all_topics(0)
    topic_users = User.cache.get_dict({o.user_id for o in topics})
    topic_cafes = CafeTopic.get_topics_cafes([o.id for o in topics])
    return render_template(
        'front/index.html',
        topics=topics,
        topic_users=topic_users,
        topic_cafes=topic_cafes,
    )
Ejemplo n.º 4
0
def home():
    topics, _ = get_all_topics(0)
    topic_users = User.cache.get_dict({o.user_id for o in topics})
    topic_cafes = CafeTopic.get_topics_cafes([o.id for o in topics])
    return render(
        'front/index.html',
        topics=topics,
        topic_users=topic_users,
        topic_cafes=topic_cafes,
    )
Ejemplo n.º 5
0
def timeline():
    cursor = int_or_raise('cursor', 0)
    if request.args.get('show') == 'all':
        topics, cursor = get_all_topics(cursor)
    else:
        topics, cursor = get_timeline_topics(cursor, current_user.id)

    topics_cafes = CafeTopic.get_topics_cafes([t.id for t in topics])
    data = []
    for d in iter_items_with_users(topics):
        d['cafes'] = topics_cafes.get(d['id'])
        data.append(d)
    data = list(iter_topics_with_statuses(data, current_user.id))
    return jsonify(data=data, cursor=cursor)
Ejemplo n.º 6
0
def timeline():
    cursor = int_or_raise('cursor', 0)
    if request.args.get('show') == 'all':
        topics, cursor = get_all_topics(cursor)
    else:
        topics, cursor = get_timeline_topics(cursor, current_user.id)

    topics_cafes = CafeTopic.get_topics_cafes([t.id for t in topics])
    data = []
    for d in iter_items_with_users(topics):
        d['cafes'] = topics_cafes.get(d['id'])
        data.append(d)
    data = list(iter_topics_with_statuses(data, current_user.id))
    return jsonify(data=data, cursor=cursor)