Ejemplo n.º 1
0
def events_file_server():
    si = StringIO.StringIO()
    cw = csv.writer(si)
    events = Event.get_earlier_than()
    cw.writerows([(e.date, e.description) for e in events])
    output = make_response(si.getvalue())
    output.headers["Content-Disposition"] = "attachment; filename=events.csv"
    output.headers["Content-type"] = "text/csv"
    return output
Ejemplo n.º 2
0
def events_file_server():
    si = StringIO.StringIO()
    cw = csv.writer(si)
    events = Event.get_earlier_than()
    cw.writerows([(e.date, e.description) for e in events])
    output = make_response(si.getvalue())
    output.headers["Content-Disposition"] = "attachment; filename=events.csv"
    output.headers["Content-type"] = "text/csv"
    return output
Ejemplo n.º 3
0
def events_server(middle_key_or_date=None):
    """
    Show a page of all the events, or all events EARLIER than a given key/date
    """
    try:
        events = Event.get_earlier_than(middle_key_or_date)
        title = "Earlier Events" if middle_key_or_date else "All Events"
        return render_template('events.html', events=events, title=title)
    except TimeGhostError as err:
        return render_template('error.html', err=err), 404
Ejemplo n.º 4
0
def events_server(middle_key_or_date=None):
    """
    Show a page of all the events, or all events EARLIER than a given key/date
    """
    try:
        events = Event.get_earlier_than(middle_key_or_date)

        title = "All Events"
        if middle_key_or_date:
            title = "Events before {0.description}".format(middle)

        return render_template('events.html', events=events, title=title)
    except TimeGhostError as err:
        return render_template('error.html', err=err), 404