Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
96daea5c
Commit
96daea5c
authored
Dec 12, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignore discussion modules with missing keys when building the global discussion info
parent
6e492aba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
lms/djangoapps/django_comment_client/utils.py
+12
-2
No files found.
lms/djangoapps/django_comment_client/utils.py
View file @
96daea5c
...
...
@@ -17,6 +17,7 @@ from xmodule.modulestore import Location
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.search
import
path_to_location
log
=
logging
.
getLogger
(
__name__
)
# TODO these should be cached via django's caching rather than in-memory globals
_FULLMODULES
=
None
...
...
@@ -141,6 +142,15 @@ def initialize_discussion_info(course):
for
location
,
module
in
all_modules
.
items
():
if
location
.
category
==
'discussion'
:
skip_module
=
False
for
key
in
(
'id'
,
'discussion_category'
,
'for'
):
if
key
not
in
module
.
metadata
:
log
.
warning
(
"Required key '
%
s' not in discussion
%
s, leaving out of category map"
%
(
key
,
module
.
location
))
skip_module
=
True
if
skip_module
:
continue
id
=
module
.
metadata
[
'id'
]
category
=
module
.
metadata
[
'discussion_category'
]
title
=
module
.
metadata
[
'for'
]
...
...
@@ -245,7 +255,7 @@ class QueryCountDebugMiddleware(object):
query_time
=
query
.
get
(
'duration'
,
0
)
/
1000
total_time
+=
float
(
query_time
)
log
ging
.
info
(
'
%
s queries run, total
%
s seconds'
%
(
len
(
connection
.
queries
),
total_time
))
log
.
info
(
'
%
s queries run, total
%
s seconds'
%
(
len
(
connection
.
queries
),
total_time
))
return
response
def
get_ability
(
course_id
,
content
,
user
):
...
...
@@ -317,7 +327,7 @@ def extend_content(content):
user
=
User
.
objects
.
get
(
pk
=
content
[
'user_id'
])
roles
=
dict
((
'name'
,
role
.
name
.
lower
())
for
role
in
user
.
roles
.
filter
(
course_id
=
content
[
'course_id'
]))
except
user
.
DoesNotExist
:
log
ging
.
error
(
'User ID {0} in comment content {1} but not in our DB.'
.
format
(
content
.
get
(
'user_id'
),
content
.
get
(
'id'
)))
log
.
error
(
'User ID {0} in comment content {1} but not in our DB.'
.
format
(
content
.
get
(
'user_id'
),
content
.
get
(
'id'
)))
content_info
=
{
'displayed_title'
:
content
.
get
(
'highlighted_title'
)
or
content
.
get
(
'title'
,
''
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment