Example #1
0
    def _q_lookup(self, request, num):
        user = request.user
        if not user or not num.isdigit():
            raise TraversalError
        num = int(num)
        actions = get_user_inbox(user.username).get_actions(start=num, stop=num+PAGE_ACTIONS_COUNT-1)
        length = len(actions)
        render_html = render_actions(actions, show_avatar=True)

        return {'result': render_html, 'length': length}
Example #2
0
File: m.py Project: leeccong/code
def actions(request):
    since_id = request.get_form_var('since_id', '')
    is_public = request.get_form_var('is_public', '')
    user = request.user
    all_actions = []
    if is_public == 'true':
        all_actions = get_public_feed().get_actions(0, MAX_ACT_COUNT)
    elif user:
        all_actions = get_user_inbox(user.username).get_actions(
            0, MAX_ACT_COUNT)
    if since_id:
        actions = []
        for action in all_actions:
            if action.get('uid') == since_id:
                break
            actions.append(action)
    else:
        actions = all_actions
    return st('/m/actions.html', **locals())