예제 #1
0
def add_custom_event():
    event = request.json
    event['begin'] = datetime.strptime(event['begin'], '%Y-%m-%d %H:%M').astimezone(evt.TZ)
    event['end'] = datetime.strptime(event['end'], '%Y-%m-%d %H:%M').astimezone(evt.TZ)
    if event.get('end_recurrence'):
        event['end_recurrence'] = datetime.strptime(event['end_recurrence'], '%Y-%m-%d %H:%M').astimezone(evt.TZ)
        event = evt.RecurringCustomEvent(**event)
    else:
        event = evt.CustomEvent(**event)
    session['current_schedule'].add_custom_event(event)
    session['current_schedule_modified'] = True
    return jsonify({
        'event': event.json(),
    }), 200
예제 #2
0
def add_custom_event():
    event = request.json
    event["begin"] = datetime.strptime(event["begin"],
                                       "%Y-%m-%d %H:%M").astimezone(evt.TZ)
    event["end"] = datetime.strptime(event["end"],
                                     "%Y-%m-%d %H:%M").astimezone(evt.TZ)
    if event.get("end_recurrence"):
        event["end_recurrence"] = datetime.strptime(
            event["end_recurrence"], "%Y-%m-%d %H:%M").astimezone(evt.TZ)
        event = evt.RecurringCustomEvent(**event)
    else:
        event = evt.CustomEvent(**event)
    session["current_schedule"].add_custom_event(event)
    session["current_schedule_modified"] = True
    return (jsonify({"event": event.json()}), 200)
예제 #3
0
def update_notification(link):
    event = evt.RecurringCustomEvent(
        **{
            'name':
            'There is a new ADE Scheduler version -- go check it now !',
            'location': 'https://ade-scheduler.info.ucl.ac.be',
            'description': 'The new version is GREAT !',
            'begin': '2020-01-01 08:00',
            'end': '2020-01-01 18:00',
            'freq': [0, 1, 2, 3, 4, 5, 6],
            'end_recurrence': '2021-12-31 18:00',
        })
    calendar = Calendar(events=[event])
    resp = make_response(str(calendar))
    resp.mimetype = 'text/calendar'
    resp.headers['Content-Disposition'] = 'attachment; filename=calendar.ics'
    g.track_var['old user link'] = link
    return resp
예제 #4
0
def update_notification(link):
    event = evt.RecurringCustomEvent(
        **{
            "name":
            "There is a new ADE Scheduler version -- go check it now !",
            "location": "https://ade-scheduler.info.ucl.ac.be",
            "description": "The new version is GREAT !",
            "begin": "2020-01-01 08:00",
            "end": "2020-01-01 18:00",
            "freq": [0, 1, 2, 3, 4, 5, 6],
            "end_recurrence": "2021-12-31 18:00",
        })
    calendar = Calendar(events=[event])
    resp = make_response(str(calendar))
    resp.mimetype = "text/calendar"
    resp.headers["Content-Disposition"] = "attachment; filename=calendar.ics"
    g.track_var["old user link"] = link
    return resp