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
ceeea664
Commit
ceeea664
authored
Aug 07, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix overrzealous file_to_filename conversion and fix CapaProblem unit tests
parent
c5fa6bac
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
8 deletions
+19
-8
common/lib/capa/capa/util.py
+13
-5
common/lib/xmodule/xmodule/tests/__init__.py
+1
-1
common/lib/xmodule/xmodule/x_module.py
+5
-2
No files found.
common/lib/capa/capa/util.py
View file @
ceeea664
...
...
@@ -39,10 +39,18 @@ def convert_files_to_filenames(answers):
'''
new_answers
=
dict
()
for
answer_id
in
answers
.
keys
():
# TODO This should be done more cleanly; however, this fixes bugs
# that were introduced with this function.
if
isinstance
(
answers
[
answer_id
],
list
):
new_answers
[
answer_id
]
=
answers
[
answer_id
]
if
is_uploaded_file
(
answers
[
answer_id
]):
new_answers
[
answer_id
]
=
answers
[
answer_id
]
.
name
else
:
new_answers
[
answer_id
]
=
unicode
(
answers
[
answer_id
])
new_answers
[
answer_id
]
=
answers
[
answer_id
]
return
new_answers
def
is_uploaded_file
(
file_to_test
):
'''
Duck typing to check if 'file_to_test' is a File object
'''
is_file
=
True
for
method
in
[
'read'
,
'name'
]:
if
not
hasattr
(
file_to_test
,
method
):
is_file
=
False
return
is_file
common/lib/xmodule/xmodule/tests/__init__.py
View file @
ceeea664
...
...
@@ -31,7 +31,7 @@ i4xs = ModuleSystem(
user
=
Mock
(),
filestore
=
fs
.
osfs
.
OSFS
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))),
debug
=
True
,
xqueue
=
None
,
# TODO FIXME
xqueue
=
None
,
is_staff
=
False
)
...
...
common/lib/xmodule/xmodule/x_module.py
View file @
ceeea664
...
...
@@ -643,7 +643,7 @@ class ModuleSystem(object):
user
=
None
,
filestore
=
None
,
debug
=
False
,
xqueue
=
None
,
xqueue
=
None
,
is_staff
=
False
):
'''
Create a closure around the system environment.
...
...
@@ -678,7 +678,10 @@ class ModuleSystem(object):
TODO (vshnayder): this will need to change once we have real user roles.
'''
self
.
ajax_url
=
ajax_url
self
.
xqueue
=
xqueue
if
xqueue
is
None
:
self
.
xqueue
=
{
'interface'
:
None
,
'callback_url'
:
'/'
,
'default_queuename'
:
'null'
}
else
:
self
.
xqueue
=
xqueue
self
.
track_function
=
track_function
self
.
filestore
=
filestore
self
.
get_module
=
get_module
...
...
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