예제 #1
0
파일: home.py 프로젝트: safetiesoff/ocfweb
def home(request):
    hours = [get_hours(date.today() + timedelta(days=i)) for i in range(3)]

    blog_posts = [
        post for post in get_blog_posts()
        if timezone.now() - post.published < timedelta(days=365)
    ][:2]

    return render_to_response(
        'home.html',
        {
            'fulltitle':
            'Open Computing Facility at UC Berkeley',
            'description':
            ('The Open Computing Facility is an all-volunteer student '
             'organization dedicated to free and open-source computing for all UC '
             'Berkeley students.'
             ''),
            'staff_hours':
            get_staff_hours_soonest_first()[:2],
            'hours':
            hours,
            'today':
            hours[0],
            'blog_posts':
            blog_posts,
            'lab_status':
            get_lab_status(),
        },
        context_instance=RequestContext(request),
    )
예제 #2
0
파일: home.py 프로젝트: chriskuehl/ocfweb
def home(request):
    hours = [
        get_hours(date.today() + timedelta(days=i)) for i in range(7)
    ]

    blog_posts = [
        post for post
        in get_blog_posts()
        if timezone.now() - post.published < timedelta(days=365)
    ][:2]

    return render_to_response(
        'home.html',
        {
            'fulltitle': 'Open Computing Facility at UC Berkeley',
            'description': (
                'The Open Computing Facility is an all-volunteer student '
                'organization dedicated to free and open-source computing for all UC '
                'Berkeley students.'''
            ),
            'staff_hours': get_staff_hours_soonest_first()[:2],
            'hours': hours,
            'today': hours[0],
            'blog_posts': blog_posts,
            'lab_status': get_lab_status(),
        },
        context_instance=RequestContext(request),
    )
예제 #3
0
    def test_creation(self, mock_hours, mock_today, when, weekday, holiday, open, close):
        for day_hours in [DayHours.from_date(when), get_hours(when)]:
            if when:
                if isinstance(when, datetime):
                    day = when.date()
                else:
                    day = when
            else:
                day = date.today()

            assert day_hours.date == day
            assert day_hours.weekday == weekday
            assert day_hours.open == open
            assert day_hours.holiday == holiday
            assert day_hours.close == close