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
f7c87aa7
Commit
f7c87aa7
authored
Aug 25, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Anonymous student id is a property of ModuleSystem
parent
27459efc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
10 deletions
+24
-10
common/lib/capa/capa/responsetypes.py
+4
-4
common/lib/xmodule/xmodule/tests/__init__.py
+3
-2
common/lib/xmodule/xmodule/x_module.py
+9
-2
lms/djangoapps/courseware/module_render.py
+8
-2
No files found.
common/lib/capa/capa/responsetypes.py
View file @
f7c87aa7
...
...
@@ -1123,10 +1123,11 @@ class CodeResponse(LoncapaResponse):
# Prepare xqueue request
#------------------------------------------------------------
qinterface
=
self
.
system
.
xqueue
[
'interface'
]
anonymous_student_id
=
self
.
system
.
anonymous_student_id
# Generate header
queuekey
=
xqueue_interface
.
make_hashkey
(
str
(
self
.
system
.
seed
)
+
str
(
time
.
time
())
+
str
(
self
.
system
.
xqueue
[
'student_identifier'
])
+
anonymous_student_id
+
self
.
answer_id
)
xheader
=
xqueue_interface
.
make_xheader
(
lms_callback_url
=
self
.
system
.
xqueue
[
'callback_url'
],
lms_key
=
queuekey
,
...
...
@@ -1134,15 +1135,14 @@ class CodeResponse(LoncapaResponse):
# Generate body
if
is_list_of_files
(
submission
):
self
.
context
.
update
({
'submission'
:
queuekey
})
# For tracking. TODO: May want to record something else her
e
self
.
context
.
update
({
'submission'
:
''
})
# TODO: Get S3 pointer from the Queu
e
else
:
self
.
context
.
update
({
'submission'
:
submission
})
contents
=
self
.
payload
.
copy
()
# Anonymized student identifier to the external grader
student_identifier_hash
=
xqueue_interface
.
make_hashkey
(
self
.
system
.
xqueue
[
'student_identifier'
])
student_info
=
{
'student_identifier_hash'
:
student_identifier_hash
}
student_info
=
{
'anonymous_student_id'
:
anonymous_student_id
}
contents
.
update
({
'student_info'
:
json
.
dumps
(
student_info
)})
# Submit request. When successful, 'msg' is the prior length of the queue
...
...
common/lib/xmodule/xmodule/tests/__init__.py
View file @
f7c87aa7
...
...
@@ -35,8 +35,9 @@ i4xs = ModuleSystem(
user
=
Mock
(),
filestore
=
fs
.
osfs
.
OSFS
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
+
"/test_files"
),
debug
=
True
,
xqueue
=
{
'interface'
:
None
,
'callback_url'
:
'/'
,
'default_queuename'
:
'testqueue'
,
'student_identifier'
:
0
},
node_path
=
os
.
environ
.
get
(
"NODE_PATH"
,
"/usr/local/lib/node_modules"
)
xqueue
=
{
'interface'
:
None
,
'callback_url'
:
'/'
,
'default_queuename'
:
'testqueue'
},
node_path
=
os
.
environ
.
get
(
"NODE_PATH"
,
"/usr/local/lib/node_modules"
),
anonymous_student_id
=
'student'
)
...
...
common/lib/xmodule/xmodule/x_module.py
View file @
f7c87aa7
...
...
@@ -717,7 +717,8 @@ class ModuleSystem(object):
filestore
=
None
,
debug
=
False
,
xqueue
=
None
,
node_path
=
""
):
node_path
=
""
,
anonymous_student_id
=
''
):
'''
Create a closure around the system environment.
...
...
@@ -742,11 +743,16 @@ class ModuleSystem(object):
at settings.DATA_DIR.
xqueue - Dict containing XqueueInterface object, as well as parameters
for the specific StudentModule
for the specific StudentModule:
xqueue = {'interface': XQueueInterface object,
'callback_url': Callback into the LMS,
'queue_name': Target queuename in Xqueue}
replace_urls - TEMPORARY - A function like static_replace.replace_urls
that capa_module can use to fix up the static urls in
ajax results.
anonymous_student_id - Used for tracking modules with student id
'''
self
.
ajax_url
=
ajax_url
self
.
xqueue
=
xqueue
...
...
@@ -758,6 +764,7 @@ class ModuleSystem(object):
self
.
seed
=
user
.
id
if
user
is
not
None
else
0
self
.
replace_urls
=
replace_urls
self
.
node_path
=
node_path
self
.
anonymous_student_id
=
anonymous_student_id
def
get
(
self
,
attr
):
''' provide uniform access to attributes (like etree).'''
...
...
lms/djangoapps/courseware/module_render.py
View file @
f7c87aa7
import
hashlib
import
json
import
logging
import
sys
...
...
@@ -173,6 +174,11 @@ def _get_module(user, request, location, student_module_cache, course_id, positi
if
not
has_access
(
user
,
descriptor
,
'load'
):
return
None
# Anonymized student identifier
h
=
hashlib
.
md5
()
# TODO: Seed with LMS secret key
h
.
update
(
str
(
user
.
id
))
anonymous_student_id
=
h
.
hexdigest
()
#TODO Only check the cache if this module can possibly have state
instance_module
=
None
shared_module
=
None
...
...
@@ -218,7 +224,6 @@ def _get_module(user, request, location, student_module_cache, course_id, positi
xqueue
=
{
'interface'
:
xqueue_interface
,
'callback_url'
:
xqueue_callback_url
,
'default_queuename'
:
xqueue_default_queuename
.
replace
(
' '
,
'_'
),
'student_identifier'
:
user
.
id
,
}
def
inner_get_module
(
location
):
...
...
@@ -243,7 +248,8 @@ def _get_module(user, request, location, student_module_cache, course_id, positi
# a module is coming through get_html and is therefore covered
# by the replace_static_urls code below
replace_urls
=
replace_urls
,
node_path
=
settings
.
NODE_PATH
node_path
=
settings
.
NODE_PATH
,
anonymous_student_id
=
anonymous_student_id
)
# pass position specified in URL to module through ModuleSystem
system
.
set
(
'position'
,
position
)
...
...
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