예제 #1
0
파일: views.py 프로젝트: DHS/meetit
def demo(request):
	data = soap_request()
        cal = Calendar()
	new_events = []

        for event in data['events']:
            ev = create_journey('NW3 5TN', event)
            if ev: 
                cal.add_component(ev)
                new_events.append({'departure': to_local(parse(str(ev['dtstart']))), 'arrival': to_local(parse(str(ev['dtend']))), 'name': ev['summary']})
                
        if cal.subcomponents:
            evs = len(new_events)
            title = "%s events" % evs if evs >= 2 else new_events[0]['name']

            generate_soap(data['email'], cal, title)
	
	return HttpResponse('fingers crossed')
예제 #2
0
파일: views.py 프로젝트: Geekathon/meetit
def email(request):

    if request.POST and 'origin' in request.POST:
        new_events = []
        originForm = OriginForm(request.POST)
        if originForm.is_valid():
            origin_CD = originForm.cleaned_data
            origin = origin_CD['origin']

            data = soap_request()

            cal = Calendar()

            for event in data['events']:
                ev = create_journey(origin, event)
                if ev:
                    cal.add_component(ev)
                    new_events.append({
                        'departure':
                        to_local(parse(str(ev['dtstart']))),
                        'arrival':
                        to_local(parse(str(ev['dtend']))),
                        'name':
                        ev['summary']
                    })

            if cal.subcomponents:
                evs = len(new_events)
                title = "%s events" % evs if evs >= 2 else new_events[0]['name']

                generate_soap(data['email'], cal, title)

                message = "email successfully sent"

            else:
                message = "no events found"

            return render_to_response('base_email_response.html', locals())

    else:
        originForm = OriginForm()

    return render_to_response('base_email.html', locals())
예제 #3
0
파일: views.py 프로젝트: Geekathon/meetit
def demo(request):
    data = soap_request()
    cal = Calendar()
    new_events = []

    for event in data['events']:
        ev = create_journey('NW3 5TN', event)
        if ev:
            cal.add_component(ev)
            new_events.append({
                'departure': to_local(parse(str(ev['dtstart']))),
                'arrival': to_local(parse(str(ev['dtend']))),
                'name': ev['summary']
            })

    if cal.subcomponents:
        evs = len(new_events)
        title = "%s events" % evs if evs >= 2 else new_events[0]['name']

        generate_soap(data['email'], cal, title)

    return HttpResponse('fingers crossed')
예제 #4
0
파일: views.py 프로젝트: DHS/meetit
def email(request):

    if request.POST and 'origin' in request.POST:
        new_events = []
        originForm = OriginForm(request.POST)
        if originForm.is_valid():
            origin_CD = originForm.cleaned_data
            origin = origin_CD['origin']

            data = soap_request()

            cal = Calendar()

            for event in data['events']:
                ev = create_journey(origin, event)
                if ev: 
                    cal.add_component(ev)
                    new_events.append({'departure': to_local(parse(str(ev['dtstart']))), 'arrival': to_local(parse(str(ev['dtend']))), 'name': ev['summary']})
                
            if cal.subcomponents:
                evs = len(new_events)
                title = "%s events" % evs if evs >= 2 else new_events[0]['name']

                generate_soap(data['email'], cal, title)

                message = "email successfully sent"

            else:
                message = "no events found"

            return render_to_response('base_email_response.html', locals())

    else:
        originForm = OriginForm()

    return render_to_response('base_email.html', locals())