当前位置: 首页>>代码示例>>Python>>正文


Python User.get_by_checkin_code方法代码示例

本文整理汇总了Python中models.user.User.get_by_checkin_code方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_by_checkin_code方法的具体用法?Python User.get_by_checkin_code怎么用?Python User.get_by_checkin_code使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.user.User的用法示例。


在下文中一共展示了User.get_by_checkin_code方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: favourites_ical

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_by_checkin_code [as 别名]
def favourites_ical():
    code = request.args.get('token', None)
    user = None
    if code:
        user = User.get_by_checkin_code(app.config.get('FEED_SECRET_KEY'), str(code))
    if not current_user.is_anonymous:
        user = current_user
    if not user:
        abort(404)

    schedule = _get_scheduled_proposals(request.args, override_user=user)
    title = 'EMF {} Favourites for {}'.format(event_start().year, user.name)

    cal = Calendar()
    cal.add('summary', title)
    cal.add('X-WR-CALNAME', title)
    cal.add('X-WR-CALDESC', title)
    cal.add('version', '2.0')

    for event in schedule:
        if not event['is_fave']:
            continue
        cal_event = Event()
        cal_event.add('uid', event['id'])
        cal_event.add('summary', event['title'])
        cal_event.add('description', event['description'])
        cal_event.add('location', event['venue'])
        cal_event.add('dtstart', event['start_date'])
        cal_event.add('dtend', event['end_date'])
        cal.add_component(cal_event)

    return Response(cal.to_ical(), mimetype='text/calendar')
开发者ID:dominicgs,项目名称:Website,代码行数:34,代码来源:schedule.py

示例2: checkin_qrcode

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_by_checkin_code [as 别名]
def checkin_qrcode(code):
    match = re.match('%s$' % checkin_code_re, code)
    if not match:
        abort(404)

    user = User.get_by_checkin_code(app.config.get('SECRET_KEY'), code)
    return redirect(url_for('.checkin', user_id=user.id, source='code'))
开发者ID:dominicgs,项目名称:Website,代码行数:9,代码来源:arrivals.py

示例3: user_from_code

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_by_checkin_code [as 别名]
def user_from_code(query):
    if not query:
        return None

    # QR code
    match = re.match(re.escape(app.config.get('CHECKIN_BASE')) + '(%s)$' % checkin_code_re, query)
    if not match:
        # Barcode
        match = re.match('(%s)$' % checkin_code_re, query)

    if not match:
        return None

    code = match.group(1)
    user = User.get_by_checkin_code(app.config.get('SECRET_KEY'), code)
    return user
开发者ID:dominicgs,项目名称:Website,代码行数:18,代码来源:arrivals.py

示例4: favourites_json

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_by_checkin_code [as 别名]
def favourites_json():
    code = request.args.get('token', None)
    user = None
    if code:
        user = User.get_by_checkin_code(app.config.get('FEED_SECRET_KEY'), str(code))
    if not current_user.is_anonymous:
        user = current_user
    if not user:
        abort(404)

    def convert_time_to_str(event):
        event['start_date'] = event['start_date'].strftime('%Y-%m-%d %H:%M:00')
        event['end_date'] = event['end_date'].strftime('%Y-%m-%d %H:%M:00')
        return event

    schedule = [convert_time_to_str(p) for p in _get_scheduled_proposals(request.args, override_user=user) if p['is_fave']]

    # NB this is JSON in a top-level array (security issue for low-end browsers)
    return Response(json.dumps(schedule), mimetype='application/json')
开发者ID:dominicgs,项目名称:Website,代码行数:21,代码来源:schedule.py


注:本文中的models.user.User.get_by_checkin_code方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。