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
7fcfe035
Commit
7fcfe035
authored
Jan 10, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into diana/peer-grading-views
parents
81bb2dc9
941d55ce
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
32 deletions
+26
-32
common/lib/capa/capa/responsetypes.py
+2
-2
common/lib/xmodule/xmodule/modulestore/__init__.py
+3
-3
common/lib/xmodule/xmodule/modulestore/mongo.py
+3
-3
common/lib/xmodule/xmodule/modulestore/search.py
+1
-1
common/lib/xmodule/xmodule/modulestore/tests/test_modulestore.py
+0
-9
common/lib/xmodule/xmodule/modulestore/xml.py
+14
-12
lms/lib/symmath/formula.py
+3
-2
No files found.
common/lib/capa/capa/responsetypes.py
View file @
7fcfe035
...
...
@@ -629,7 +629,7 @@ class MultipleChoiceResponse(LoncapaResponse):
# define correct choices (after calling secondary setup)
xml
=
self
.
xml
cxml
=
xml
.
xpath
(
'//*[@id=$id]//choice[@correct="true"]'
,
id
=
xml
.
get
(
'id'
))
self
.
correct_choices
=
[
c
hoice
.
get
(
'name'
)
for
choice
in
cxml
]
self
.
correct_choices
=
[
c
ontextualize_text
(
choice
.
get
(
'name'
),
self
.
context
)
for
choice
in
cxml
]
def
mc_setup_response
(
self
):
'''
...
...
@@ -723,7 +723,7 @@ class OptionResponse(LoncapaResponse):
return
cmap
def
get_answers
(
self
):
amap
=
dict
([(
af
.
get
(
'id'
),
af
.
get
(
'correct'
))
for
af
in
self
.
answer_fields
])
amap
=
dict
([(
af
.
get
(
'id'
),
contextualize_text
(
af
.
get
(
'correct'
),
self
.
context
))
for
af
in
self
.
answer_fields
])
# log.debug('%s: expected answers=%s' % (unicode(self),amap))
return
amap
...
...
common/lib/xmodule/xmodule/modulestore/__init__.py
View file @
7fcfe035
...
...
@@ -345,9 +345,9 @@ class ModuleStore(object):
'''
raise
NotImplementedError
def
get_parent_locations
(
self
,
location
):
'''Find all locations that are the parents of this location
. Needed
for path_to_location().
def
get_parent_locations
(
self
,
location
,
course_id
):
'''Find all locations that are the parents of this location
in this
course. Needed
for path_to_location().
returns an iterable of things that can be passed to Location.
'''
...
...
common/lib/xmodule/xmodule/modulestore/mongo.py
View file @
7fcfe035
...
...
@@ -309,9 +309,9 @@ class MongoModuleStore(ModuleStoreBase):
self
.
_update_single_item
(
location
,
{
'metadata'
:
metadata
})
def
get_parent_locations
(
self
,
location
):
'''Find all locations that are the parents of this location
. Needed
for path_to_location().
def
get_parent_locations
(
self
,
location
,
course_id
):
'''Find all locations that are the parents of this location
in this
course. Needed
for path_to_location().
If there is no data at location in this modulestore, raise
ItemNotFoundError.
...
...
common/lib/xmodule/xmodule/modulestore/search.py
View file @
7fcfe035
...
...
@@ -64,7 +64,7 @@ def path_to_location(modulestore, course_id, location):
# isn't found so we don't have to do it explicitly. Call this
# first to make sure the location is there (even if it's a course, and
# we would otherwise immediately exit).
parents
=
modulestore
.
get_parent_locations
(
loc
)
parents
=
modulestore
.
get_parent_locations
(
loc
,
course_id
)
# print 'Processing loc={0}, path={1}'.format(loc, path)
if
loc
.
category
==
"course"
:
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_modulestore.py
View file @
7fcfe035
...
...
@@ -23,12 +23,3 @@ def check_path_to_location(modulestore):
for
location
in
not_found
:
assert_raises
(
ItemNotFoundError
,
path_to_location
,
modulestore
,
course_id
,
location
)
# Since our test files are valid, there shouldn't be any
# elements with no path to them. But we can look for them in
# another course.
no_path
=
(
"i4x://edX/simple/video/Lost_Video"
,
)
for
location
in
no_path
:
assert_raises
(
NoPathToItem
,
path_to_location
,
modulestore
,
course_id
,
location
)
common/lib/xmodule/xmodule/modulestore/xml.py
View file @
7fcfe035
...
...
@@ -275,14 +275,16 @@ class XMLModuleStore(ModuleStoreBase):
class_
=
getattr
(
import_module
(
module_path
),
class_name
)
self
.
default_class
=
class_
self
.
parent_tracker
=
ParentTracker
(
)
self
.
parent_tracker
s
=
defaultdict
(
ParentTracker
)
# If we are specifically asked for missing courses, that should
# be an error. If we are asked for "all" courses, find the ones
# that have a course.xml
# that have a course.xml. We sort the dirs in alpha order so we always
# read things in the same order (OS differences in load order have
# bitten us in the past.)
if
course_dirs
is
None
:
course_dirs
=
[
d
for
d
in
os
.
listdir
(
self
.
data_dir
)
if
os
.
path
.
exists
(
self
.
data_dir
/
d
/
"course.xml"
)]
course_dirs
=
sorted
(
[
d
for
d
in
os
.
listdir
(
self
.
data_dir
)
if
os
.
path
.
exists
(
self
.
data_dir
/
d
/
"course.xml"
)])
for
course_dir
in
course_dirs
:
self
.
try_load_course
(
course_dir
)
...
...
@@ -307,7 +309,7 @@ class XMLModuleStore(ModuleStoreBase):
if
course_descriptor
is
not
None
:
self
.
courses
[
course_dir
]
=
course_descriptor
self
.
_location_errors
[
course_descriptor
.
location
]
=
errorlog
self
.
parent_tracker
.
make_known
(
course_descriptor
.
location
)
self
.
parent_tracker
s
[
course_descriptor
.
id
]
.
make_known
(
course_descriptor
.
location
)
else
:
# Didn't load course. Instead, save the errors elsewhere.
self
.
errored_courses
[
course_dir
]
=
errorlog
...
...
@@ -432,7 +434,7 @@ class XMLModuleStore(ModuleStoreBase):
course_dir
,
policy
,
tracker
,
self
.
parent_tracker
,
self
.
parent_tracker
s
[
course_id
]
,
self
.
load_error_modules
,
)
...
...
@@ -541,9 +543,9 @@ class XMLModuleStore(ModuleStoreBase):
"""
raise
NotImplementedError
(
"XMLModuleStores are read-only"
)
def
get_parent_locations
(
self
,
location
):
'''Find all locations that are the parents of this location
. Needed
for path_to_location().
def
get_parent_locations
(
self
,
location
,
course_id
):
'''Find all locations that are the parents of this location
in this
course. Needed
for path_to_location().
If there is no data at location in this modulestore, raise
ItemNotFoundError.
...
...
@@ -552,7 +554,7 @@ class XMLModuleStore(ModuleStoreBase):
be empty if there are no parents.
'''
location
=
Location
.
ensure_fully_specified
(
location
)
if
not
self
.
parent_tracker
.
is_known
(
location
):
raise
ItemNotFoundError
(
location
)
if
not
self
.
parent_tracker
s
[
course_id
]
.
is_known
(
location
):
raise
ItemNotFoundError
(
"{0} not in {1}"
.
format
(
location
,
course_id
)
)
return
self
.
parent_tracker
.
parents
(
location
)
return
self
.
parent_tracker
s
[
course_id
]
.
parents
(
location
)
lms/lib/symmath/formula.py
View file @
7fcfe035
...
...
@@ -422,7 +422,8 @@ class formula(object):
def
GetContentMathML
(
self
,
asciimath
,
mathml
):
# URL = 'http://192.168.1.2:8080/snuggletex-webapp-1.2.2/ASCIIMathMLUpConversionDemo'
URL
=
'http://127.0.0.1:8080/snuggletex-webapp-1.2.2/ASCIIMathMLUpConversionDemo'
# URL = 'http://127.0.0.1:8080/snuggletex-webapp-1.2.2/ASCIIMathMLUpConversionDemo'
URL
=
'https://math-xserver.mitx.mit.edu/snuggletex-webapp-1.2.2/ASCIIMathMLUpConversionDemo'
if
1
:
payload
=
{
'asciiMathInput'
:
asciimath
,
...
...
@@ -430,7 +431,7 @@ class formula(object):
#'asciiMathML':unicode(mathml).encode('utf-8'),
}
headers
=
{
'User-Agent'
:
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13"
}
r
=
requests
.
post
(
URL
,
data
=
payload
,
headers
=
headers
)
r
=
requests
.
post
(
URL
,
data
=
payload
,
headers
=
headers
,
verify
=
False
)
r
.
encoding
=
'utf-8'
ret
=
r
.
text
#print "encoding: ",r.encoding
...
...
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