示例#1
0
文件: pages.py 项目: avolkov/2016-web
def about():
    """
    About page.
    """
    content, meta = get_markdown_file('about', g.lang_code)
    team = get_data_file('team.json')
    sponsors = get_data_file('sponsors.yml')
    content, meta = get_markdown_file('about', g.lang_code)

    return render_template('pages/about.html', content=content, meta=meta,
                           team=team, sponsors=sponsors)
示例#2
0
def about():
    """
    About page.
    """
    content, meta = get_markdown_file('about', g.lang_code)
    team = get_data_file('team.json')
    sponsors = get_data_file('sponsors.yml')
    content, meta = get_markdown_file('about', g.lang_code)

    return render_template('pages/about.html',
                           content=content,
                           meta=meta,
                           team=team,
                           sponsors=sponsors)
示例#3
0
文件: pages.py 项目: avolkov/2016-web
def index():
    """
    Landing page.
    """
    sponsors = get_data_file('sponsors.yml')

    return render_template('pages/index.html', sponsors=sponsors)
示例#4
0
def index():
    """
    Schedule index page.
    """
    schedule = get_data_file('schedule.json')

    return render_template('pages/schedule/index.html', schedule=schedule)
示例#5
0
def guide():
    """
    Guide to things around the venue area page.
    """
    guide = get_data_file('guide.json')

    return render_template('pages/guide.html', guide=guide)
示例#6
0
def index():
    """
    Landing page.
    """
    sponsors = get_data_file('sponsors.yml')

    return render_template('pages/index.html', sponsors=sponsors)
示例#7
0
def talk_ics(slug):
    cal = Calendar()
    cal.add('prodid', '-//PyCon Canada 2016//2016.pycon.ca')
    cal.add('version', '2.0')

    if slug == 'schedule':
        schedule = get_data_file('schedule.json')

        # TODO: This should be refactored.
        for day in schedule.get('days'):
            for slot in day.get('entries'):
                if slot.get('talks'):
                    for room, talk in slot.get('talks').iteritems():
                        if talk:
                            cal.add_component(event_ics(talk))
    else:
        cal.add_component(event_ics(slug))

    headers = {
        'Content-Disposition': 'attachment;filename={0}.ics'.format(slug)
    }

    return Response(response=cal.to_ical(),
                    status=200,
                    mimetype='text/calendar',
                    headers=headers)
示例#8
0
文件: pages.py 项目: avolkov/2016-web
def guide():
    """
    Guide to things around the venue area page.
    """
    guide = get_data_file('guide.json')

    return render_template('pages/guide.html', guide=guide)
示例#9
0
文件: pages.py 项目: avolkov/2016-web
def sponsors():
    """
    Sponsors page.
    """
    data = get_data_file('sponsors.yml')
    content, meta = get_markdown_file('sponsors', g.lang_code)

    return render_template('pages/sponsors.html', content=content, meta=meta,
                           sponsors=data)
示例#10
0
def talk_json(slug):

    if slug == 'schedule':
        content = get_data_file('schedule.json')
    else:
        description, content = get_markdown_file('talks/{}'.format(slug), 'en')
        content['description'] = description

    return jsonify(content)
示例#11
0
    def test_sponsors_yml_file(self):
        with self.app.app_context():
            sponsors = get_data_file('sponsors.yml')

        for level in sponsors:
            self.assertTrue(level['level']['en'])

            for sponsor in level['entries']:
                self.assertTrue(sponsor['logo'])
示例#12
0
    def test_data_files(self):
        data_files = []
        data_files += glob.glob(os.path.join(self.app.config['APP_PATH'],
                                             'data', '*.json'))
        data_files += glob.glob(os.path.join(self.app.config['APP_PATH'],
                                             'data', '*.yml'))

        for data_file in data_files:
            with self.app.app_context():
                self.assertTrue(get_data_file(os.path.basename(data_file)))
示例#13
0
    def test_sponsors_yml_file(self):
        with self.app.app_context():
            sponsors = get_data_file('sponsors.yml')

        for level in sponsors:
            self.assertTrue(level['level']['en'])

            for sponsor in level['entries']:
                self.assertTrue(sponsor['logo'])
                self.assertEqual(sponsor['en'].keys(),
                                 ['url', 'twitter', 'name', 'description'])
示例#14
0
def sponsors():
    """
    Sponsors page.
    """
    data = get_data_file('sponsors.yml')
    content, meta = get_markdown_file('sponsors', g.lang_code)

    return render_template('pages/sponsors.html',
                           content=content,
                           meta=meta,
                           sponsors=data)
示例#15
0
def talk_json(slug):

    if slug == 'schedule':
        content = get_data_file('schedule.json')
    else:
        description, content = get_markdown_file('talks/{}'.format(slug), 'en')

        # The Markdown Meta extension gives us everything in lists.
        # So this is a simple converter.
        for k, v in content.items():
            content[k] = v[0]

        content['description'] = description

    return jsonify(content)
示例#16
0
def talk_ics(slug):
    cal = Calendar()
    cal.add('prodid', '-//PyCon Canada 2016//2016.pycon.ca')
    cal.add('version', '2.0')

    if slug == 'schedule':
        schedule = get_data_file('schedule.json')

        # TODO: This should be refactored because it's really ugly.
        for day in schedule.get('days'):
            for slot in day.get('entries'):
                if slot.get('link'):
                    cal.add_component(event_ics(slot.get('link')))

                elif slot.get('talks'):
                    for room, talk in slot.get('talks').iteritems():
                        if talk:
                            cal.add_component(event_ics(talk))
                else:
                    start_time_str = '{0} {1}'.format(day['date'],
                                                      slot['start_time'])
                    start_time = datetime.strptime(start_time_str,
                                                   '%Y-%m-%d %H:%M:%S')

                    end_time_str = '{0} {1}'.format(day['date'],
                                                    slot['end_time'])
                    end_time = datetime.strptime(end_time_str,
                                                 '%Y-%m-%d %H:%M:%S')

                    event = Event()
                    event.add('summary', slot['title'])

                    event.add('dtstart', tz.localize(start_time))
                    event.add('dtend', tz.localize(end_time))
                    event.add('dtstamp', tz.localize(start_time))

                    cal.add_component(event)
    else:
        cal.add_component(event_ics(slug))

    headers = {
        'Content-Disposition': 'attachment;filename={0}.ics'.format(slug)
    }

    return Response(response=cal.to_ical(),
                    status=200,
                    mimetype='text/calendar',
                    headers=headers)
示例#17
0
def schedule_json():
    schedule = get_data_file('schedule.json')

    return jsonify(schedule)
示例#18
0
def schedule():
    schedule = get_data_file('schedule.json')

    return jsonify(schedule)