Esempio n. 1
0
 def activities(self, request):
     start = request.get_form_var('start', '0')
     limit = request.get_form_var('count', '20')
     if start.isdigit() and limit.isdigit():
         start = int(start)
         limit = int(limit)
     else:
         start = 0
         limit = 20
     activities = get_user_feed(self.user.username).get_actions(
         start, limit)
     return [format_timeline(activity) for activity in activities]
Esempio n. 2
0
 def activities(self, request):
     start = request.get_form_var('start', '0')
     limit = request.get_form_var('count', '20')
     if start.isdigit() and limit.isdigit():
         start = int(start)
         limit = int(limit)
     else:
         start = 0
         limit = 20
     activities = get_user_feed(self.user.username).get_actions(
         start, limit)
     return [format_timeline(activity) for activity in activities]
Esempio n. 3
0
def timeline(request):
    from vilya.models.timeline import format_timeline
    from vilya.models.feed import get_public_feed
    timestamp = request.get_form_var('timestamp')
    count = request.get_form_var('count') or 15
    start = request.get_form_var('start') or 0
    start = int(start)
    count = int(count)
    if timestamp:
        actions = get_public_feed().get_actions_by_timestamp(max=timestamp)
        actions = actions[:count]
    else:
        actions = get_public_feed().get_actions(start, start + count)
    data = []
    for action in actions:
        formated_action = format_timeline(action)
        if formated_action:
            data.append(formated_action)
    return json.dumps(data)
Esempio n. 4
0
def timeline(request):
    from vilya.models.timeline import format_timeline
    from vilya.models.feed import get_public_feed
    timestamp = request.get_form_var('timestamp')
    count = request.get_form_var('count') or 15
    start = request.get_form_var('start') or 0
    start = int(start)
    count = int(count)
    if timestamp:
        actions = get_public_feed().get_actions_by_timestamp(max=timestamp)
        actions = actions[:count]
    else:
        actions = get_public_feed().get_actions(start, start + count)
    data = []
    for action in actions:
        formated_action = format_timeline(action)
        if formated_action:
            data.append(formated_action)
    return json.dumps(data)
Esempio n. 5
0
 def timeline(self, request):
     user = request.user
     if not user:
         return []
     timestamp = request.get_form_var('timestamp')
     count = request.get_form_var('count') or 15
     start = request.get_form_var('start') or 0
     start = int(start)
     count = int(count)
     if timestamp:
         actions = get_user_inbox(
             self.user.username).get_actions_by_timestamp(max=timestamp)
         actions = actions[:count]
     else:
         actions = get_user_inbox(self.user.username).get_actions(
             start, start + count)
     data = []
     for action in actions:
         data.append(format_timeline(action))
     return data
Esempio n. 6
0
 def timeline(self, request):
     user = request.user
     if not user:
         return []
     timestamp = request.get_form_var('timestamp')
     count = request.get_form_var('count') or 15
     start = request.get_form_var('start') or 0
     start = int(start)
     count = int(count)
     if timestamp:
         actions = get_user_inbox(
             self.user.username).get_actions_by_timestamp(max=timestamp)
         actions = actions[:count]
     else:
         actions = get_user_inbox(
             self.user.username).get_actions(start, start + count)
     data = []
     for action in actions:
         data.append(format_timeline(action))
     return data