Pylint fixes

This commit is contained in:
Ned Batchelder
2013-06-28 17:25:03 -04:00
parent 25d0f4d500
commit 4ff2de69e7
2 changed files with 11 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ from django.core.urlresolvers import reverse
from courseware.tests.tests import TEST_DATA_MONGO_MODULESTORE
from student.tests.factories import UserFactory, CourseEnrollmentFactory
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
@@ -40,9 +40,9 @@ class StaticBookTest(ModuleStoreTestCase):
Make a course with an enrolled logged-in student.
"""
course = CourseFactory.create(**kwargs)
self.user = UserFactory.create()
CourseEnrollmentFactory.create(user=self.user, course_id=course.id)
self.client.login(username=self.user.username, password='test')
user = UserFactory.create()
CourseEnrollmentFactory.create(user=user, course_id=course.id)
self.client.login(username=user.username, password='test')
return course

View File

@@ -1,3 +1,7 @@
"""
Views for serving static textbooks.
"""
from django.contrib.auth.decorators import login_required
from django.http import Http404
from mitxmako.shortcuts import render_to_response
@@ -10,6 +14,9 @@ from static_replace import replace_static_urls
@login_required
def index(request, course_id, book_index, page=None):
"""
Serve static image-based textbooks.
"""
course = get_course_with_access(request.user, course_id, 'load')
staff_access = has_access(request.user, course, 'staff')