Exemplo n.º 1
0
 def test_weeks(self):
     """Test the week start/end helper functions."""
     d = datetime(2014, 1, 29)
     start = week_start(d)
     eq_(start, datetime(2014, 1, 27))
     end = week_end(d)
     eq_(end, datetime(2014, 2, 2))
Exemplo n.º 2
0
 def test_weeks(self):
     """Test the week start/end helper functions."""
     d = datetime(2014, 1, 29)
     start = week_start(d)
     eq_(start, datetime(2014, 1, 27))
     end = week_end(d)
     eq_(end, datetime(2014, 2, 2))
Exemplo n.º 3
0
def _get_timeline_params():
    params = {}
    try:
        params['count'] = numerify(request.args.get('count'), default=20)
    except (TypeError, ValueError):
        raise ApiError('Error in `count` parameter: invalid count.')
    params['since_id'] = request.args.get('since_id')
    params['max_id'] = request.args.get('max_id')
    params['trim_user'] = truthify(request.args.get('trim_user'))
    params['trim_project'] = truthify(request.args.get('trim_project'))
    params['include_replies'] = request.args.get('include_replies')
    params['weekly'] = truthify(request.args.get('weekly'))
    week = request.args.get('week')
    if week:
        if not isday(week):
            raise ApiError('Error in `week` parameter: must be YYYY-MM-DD form.')
        weekday = get_day(week)
        params['week_start'] = week_start(weekday)
        params['week_end'] = week_end(weekday)

    return params
Exemplo n.º 4
0
def _get_timeline_params():
    params = {}
    try:
        params['count'] = numerify(request.args.get('count'), default=20)
    except (TypeError, ValueError):
        raise ApiError('Error in `count` parameter: invalid count.')
    params['since_id'] = request.args.get('since_id')
    params['max_id'] = request.args.get('max_id')
    params['trim_user'] = truthify(request.args.get('trim_user'))
    params['trim_project'] = truthify(request.args.get('trim_project'))
    params['include_replies'] = request.args.get('include_replies')
    params['weekly'] = truthify(request.args.get('weekly'))
    week = request.args.get('week')
    if week:
        if not isday(week):
            raise ApiError(
                'Error in `week` parameter: must be YYYY-MM-DD form.')
        weekday = get_day(week)
        params['week_start'] = week_start(weekday)
        params['week_end'] = week_end(weekday)

    return params
Exemplo n.º 5
0
 def test_weeks(self):
     """Test the week start/end helper functions."""
     d = datetime(2014, 1, 29)
     eq_(week_start(d), datetime(2014, 1, 27, 0, 0, 0))
     eq_(week_end(d), datetime(2014, 2, 2, 23, 59, 59))
Exemplo n.º 6
0
 def test_weeks(self):
     """Test the week start/end helper functions."""
     d = datetime(2014, 1, 29)
     eq_(week_start(d), datetime(2014, 1, 27, 0, 0, 0))
     eq_(week_end(d), datetime(2014, 2, 2, 23, 59, 59))