Beispiel #1
0
def show_upcoming():
    if not session.get('logged_in'):
        flash('You are not logged in')
        logging.info('Non-Loggedin user with IP: %s try to access showUpcoming', request.remote_addr)
        return redirect(url_for('login'))
    else:
        up_dao = UpcomingDao()
        up_list = up_dao.load_crawled_upcoming_list()
        up_dao.close()
        return render_template('show_upcoming.html', upcoming_list = up_list)
Beispiel #2
0
def show_crawled_events():
    if not session.get('logged_in'):
        flash('You are not logged in')
        logging.info('Non-Loggedin user with IP: %s try to access showCrawledEvents', request.remote_addr)
        return redirect(url_for('login'))
    else:
        up_dao = UpcomingDao()
        up_list = up_dao.load_crawled_event_list(session.get('start_date'), session.get('end_date'))
        up_dao.close()
        return render_template('show_crawled_events.html', events_list = up_list, 
                               s_date = datetime.datetime.date(session.get('start_date')), 
                               e_date = datetime.datetime.date(session.get('end_date')))
Beispiel #3
0
def get_event_detail():
    if not session.get('logged_in'):
        flash('You are not logged in')
        return redirect(url_for('login'))
    else:
        event_id = request.args.get('eid', '')
        if event_id:
            up_dao = UpcomingDao()
            event_detail = up_dao.load_crawled_event_detail(event_id)
            up_dao.close()
            logging.info(type(event_detail))
            return render_template('show_crawled_event_detail.html', event = event_detail)
        else:
            flash('Parameters error.')
            return redirect(url_for('show_crawled_events'))
Beispiel #4
0
def archive_events():
    if not session.get('logged_in'):
        flash('You are not logged in')
        return redirect(url_for('login'))
    else:
        if request.method == 'POST':
            event_list = request.form.getlist('archive_event_list')
            if len(event_list) > 0:
                up_dao = UpcomingDao()
                up_dao.archive_events(event_list)
                up_dao.close()
                flash('The selected events have been archived.')
                return redirect(url_for('show_crawled_events'))
            else:
                flash('There is no event selected.')
                return redirect(url_for('show_crawled_events'))
Beispiel #5
0
def make_upcoming():
    if not session.get('logged_in'):
        flash('You are not logged in')
        return redirect(url_for('login'))
    else:
        if request.method == 'POST':
            target_list = request.form.getlist('upcoming_event')
            if len(target_list) > 0:
                
                up_dao = UpcomingDao()
                detail_event_list = up_dao.load_crawled_upcoming_details('(' + ', '.join(target_list) + ')')
                up_dao.close()
                
                create_results = make_events(detail_event_list)
                logging.info('Make upcoming event %s', ','.join([event['title'] for event in create_results]))
                return render_template('make_upcoming.html', result_list = create_results)
            else:
                flash('No event selected.')
                return render_template('make_upcoming.html', result_list = [])