From 6af4402abd1f30d784d934a91c523be5aa29f59b Mon Sep 17 00:00:00 2001 From: Don Mitchell Date: Thu, 13 Jun 2013 10:56:48 -0400 Subject: [PATCH 1/5] Squash 3 more naive datetime warnings. I think the only ones left are in migrations. --- common/djangoapps/student/tests/factories.py | 5 +++-- lms/djangoapps/courseware/tests/test_views.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/common/djangoapps/student/tests/factories.py b/common/djangoapps/student/tests/factories.py index d73bb6f01d..49864fcbd4 100644 --- a/common/djangoapps/student/tests/factories.py +++ b/common/djangoapps/student/tests/factories.py @@ -5,6 +5,7 @@ from django.contrib.auth.models import Group from datetime import datetime from factory import DjangoModelFactory, SubFactory, PostGenerationMethodCall, post_generation, Sequence from uuid import uuid4 +from pytz import UTC # Factories don't have __init__ methods, and are self documenting # pylint: disable=W0232 @@ -46,8 +47,8 @@ class UserFactory(DjangoModelFactory): is_staff = False is_active = True is_superuser = False - last_login = datetime(2012, 1, 1) - date_joined = datetime(2011, 1, 1) + last_login = datetime(2012, 1, 1, tzinfo=UTC) + date_joined = datetime(2011, 1, 1, tzinfo=UTC) @post_generation def profile(obj, create, extracted, **kwargs): diff --git a/lms/djangoapps/courseware/tests/test_views.py b/lms/djangoapps/courseware/tests/test_views.py index 1d3166893e..25492ad379 100644 --- a/lms/djangoapps/courseware/tests/test_views.py +++ b/lms/djangoapps/courseware/tests/test_views.py @@ -13,6 +13,7 @@ from xmodule.modulestore.django import modulestore import courseware.views as views from xmodule.modulestore import Location +from pytz import UTC class Stub(): @@ -63,7 +64,7 @@ class ViewsTestCase(TestCase): def setUp(self): self.user = User.objects.create(username='dummy', password='123456', email='test@mit.edu') - self.date = datetime.datetime(2013, 1, 22) + self.date = datetime.datetime(2013, 1, 22, tzinfo=UTC) self.course_id = 'edX/toy/2012_Fall' self.enrollment = CourseEnrollment.objects.get_or_create(user=self.user, course_id=self.course_id, From 8508e3f647c51014d70402a20932bc77ada7a36f Mon Sep 17 00:00:00 2001 From: Renzo Lucioni Date: Wed, 12 Jun 2013 17:45:31 -0400 Subject: [PATCH 2/5] dummy object creation without conditionals --- lms/templates/widgets/segment-io.html | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lms/templates/widgets/segment-io.html b/lms/templates/widgets/segment-io.html index 6b4ace8375..7d979c989f 100644 --- a/lms/templates/widgets/segment-io.html +++ b/lms/templates/widgets/segment-io.html @@ -1,7 +1,8 @@ -% if settings.MITX_FEATURES.get('SEGMENT_IO_LMS'): -% else: - - - -% endif From d136fdac9a7c4ea2e1e6bed0105eb18844e8b1c2 Mon Sep 17 00:00:00 2001 From: Renzo Lucioni Date: Thu, 13 Jun 2013 10:39:05 -0400 Subject: [PATCH 3/5] added comment to make clear that leaving the variable analytics outside of the feature flag block is intentional --- lms/templates/widgets/segment-io.html | 1 + 1 file changed, 1 insertion(+) diff --git a/lms/templates/widgets/segment-io.html b/lms/templates/widgets/segment-io.html index 7d979c989f..dea222653e 100644 --- a/lms/templates/widgets/segment-io.html +++ b/lms/templates/widgets/segment-io.html @@ -1,5 +1,6 @@