def timeline(request, user_id): visitor = TimelineVisitor(user_id) count = request.GET.get('count', '100') timeline = visitor.range(count=int(count)) callback = request.GET.get('callback', None) response_text = json.dumps(timeline) if callback: response_text = '%s(%s);' % (callback, response_text) return HttpResponse(response_text, mimetype='application/json')
def test_visitor_should_able_to_limit_timeline_size(self): v = TimelineVisitor(311749) r = v.range(limit=5) self.assertEquals(5, len(r['pictures']))