Commit 8d0eb7f1 by Brian Wilson

Respond to feedback (esp. use of .format())

parent 3b29ab37
import logging
from django.db import models from django.db import models
from django.contrib.auth.models import User from django.contrib.auth.models import User
import logging
from courseware.courses import get_course_by_id from courseware.courses import get_course_by_id
...@@ -20,8 +21,8 @@ class Role(models.Model): ...@@ -20,8 +21,8 @@ class Role(models.Model):
def inherit_permissions(self, role): # TODO the name of this method is a little bit confusing, def inherit_permissions(self, role): # TODO the name of this method is a little bit confusing,
# since it's one-off and doesn't handle inheritance later # since it's one-off and doesn't handle inheritance later
if role.course_id and role.course_id != self.course_id: if role.course_id and role.course_id != self.course_id:
logging.warning("%s cannot inherit permissions from %s due to course_id inconsistency" % logging.warning("{0} cannot inherit permissions from {1} due to course_id inconsistency", \
(self, role)) self, role)
for per in role.permissions.all(): for per in role.permissions.all():
self.add_permission(per) self.add_permission(per)
...@@ -30,7 +31,7 @@ class Role(models.Model): ...@@ -30,7 +31,7 @@ class Role(models.Model):
def has_permission(self, permission): def has_permission(self, permission):
course = get_course_by_id(self.course_id) course = get_course_by_id(self.course_id)
if self.name == "Student" and \ if self.name == FORUM_ROLE_STUDENT and \
(permission.startswith('edit') or permission.startswith('update') or permission.startswith('create')) and \ (permission.startswith('edit') or permission.startswith('update') or permission.startswith('create')) and \
(not course.forum_posts_allowed): (not course.forum_posts_allowed):
return False return False
......
from collections import defaultdict from collections import defaultdict
import logging
import time
import urllib
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.db import connection from django.db import connection
...@@ -7,15 +11,11 @@ from django.utils import simplejson ...@@ -7,15 +11,11 @@ from django.utils import simplejson
from django_comment_client.models import Role from django_comment_client.models import Role
from django_comment_client.permissions import check_permissions_by_view from django_comment_client.permissions import check_permissions_by_view
from mitxmako import middleware from mitxmako import middleware
import pystache_custom as pystache
from xmodule.modulestore import Location from xmodule.modulestore import Location
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from xmodule.modulestore.search import path_to_location from xmodule.modulestore.search import path_to_location
import logging
import pystache_custom as pystache
import time
import urllib
# TODO these should be cached via django's caching rather than in-memory globals # TODO these should be cached via django's caching rather than in-memory globals
...@@ -133,8 +133,6 @@ def initialize_discussion_info(course): ...@@ -133,8 +133,6 @@ def initialize_discussion_info(course):
return return
course_id = course.id course_id = course.id
# url_course_id = course_id.replace('/', '_').replace('.', '_')
all_modules = get_full_modules()[course_id] all_modules = get_full_modules()[course_id]
discussion_id_map = {} discussion_id_map = {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment