コード例 #1
0
ファイル: views.py プロジェクト: robhudson/standup
def _get_params(request):
    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")

    return params
コード例 #2
0
ファイル: views.py プロジェクト: chinna1986/standup
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'))

    return params
コード例 #3
0
ファイル: views.py プロジェクト: chinna1986/standup
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'))

    return params
コード例 #4
0
ファイル: views.py プロジェクト: Ms2ger/standup
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
コード例 #5
0
ファイル: views.py プロジェクト: abhilashsn/standup
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
コード例 #6
0
ファイル: views.py プロジェクト: Ms2ger/standup
def _handle_include_replies(qs, params):
    if not truthify(params['include_replies']):
        return qs.filter_by(reply_to_id=None)
    return qs
コード例 #7
0
ファイル: test_utils.py プロジェクト: safwanrahman/standup
def test_truthify():
    """Test the truthify function"""
    # True
    eq_(truthify('t'), True)
    eq_(truthify('T'), True)
    eq_(truthify('1'), True)
    eq_(truthify('True'), True)
    eq_(truthify('true'), True)
    eq_(truthify('TRUE'), True)
    eq_(truthify(True), True)
    eq_(truthify(1), True)

    # False
    eq_(truthify(0), False)
    eq_(truthify(False), False)
    eq_(truthify('0'), False)
    eq_(truthify('f'), False)
    eq_(truthify('False'), False)
    eq_(truthify('y'), False)
    eq_(truthify(None), False)
    eq_(truthify(u'\x80'), False)
コード例 #8
0
ファイル: settings.py プロジェクト: safwanrahman/standup
import os

from standup.utils import truthify

# Application settings.
# To override the values, create a local_settings.py and enter the
# new values there.

DEBUG = truthify(os.environ.get('DEBUG', False))

# The key used to authenticate API calls.
API_KEY = os.environ.get('API_KEY', 'qwertyuiopasdfghjklzxcvbnm1234567890')

INSTALLED_APPS = (
    'api',
    'api2',
    'landings',
    'status',
    'users'
)

API2_TIMELINE_MAX_RESULTS = os.environ.get('API2_TIMELINE_MAX_RESULTS', 800)

SITE_URL = os.environ.get('SITE_URL', 'http://127.0.0.1:5000')
SITE_TITLE = os.environ.get('SITE_TITLE', 'standup')

SESSION_SECRET = os.environ.get('SESSION_SECRET',
                                'asdfghjklqwertyuiopzxcvbnm1234567890')

DATABASE_URL = os.environ.get('DATABASE_URL', 'sqlite:///standup_app.db')
コード例 #9
0
ファイル: views.py プロジェクト: abhilashsn/standup
def _handle_include_replies(qs, params):
    if not truthify(params['include_replies']):
        return qs.filter_by(reply_to_id=None)
    return qs