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
b29649c4
Commit
b29649c4
authored
Jul 11, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow for more flexible candidates for replacement filepaths
parent
379c6d16
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
11 deletions
+20
-11
common/lib/xmodule/xmodule/capa_module.py
+6
-3
common/lib/xmodule/xmodule/html_module.py
+8
-4
common/lib/xmodule/xmodule/xml_module.py
+6
-4
No files found.
common/lib/xmodule/xmodule/capa_module.py
View file @
b29649c4
...
...
@@ -6,6 +6,7 @@ import logging
import
traceback
import
re
import
StringIO
import
os
from
datetime
import
timedelta
from
lxml
import
etree
...
...
@@ -507,6 +508,8 @@ class CapaDescriptor(RawDescriptor):
# TODO (cpennington): Delete this method once all fall 2012 course are being
# edited in the cms
@classmethod
def
backcompat_path
(
cls
,
path
):
if
path
.
startswith
(
'problem'
):
return
'problems/'
+
path
[
7
:]
def
backcompat_paths
(
cls
,
path
):
return
[
'problems/'
+
path
[
8
:],
path
[
8
:],
]
common/lib/xmodule/xmodule/html_module.py
View file @
b29649c4
import
logging
import
os
from
lxml
import
etree
from
xmodule.x_module
import
XModule
...
...
@@ -31,12 +32,15 @@ class HtmlDescriptor(RawDescriptor):
# TODO (cpennington): Delete this method once all fall 2012 course are being
# edited in the cms
@classmethod
def
backcompat_path
(
cls
,
path
):
if
path
.
startswith
(
'html/html'
):
path
=
path
[
5
:]
def
backcompat_paths
(
cls
,
path
):
if
path
.
endswith
(
'.html.html'
):
path
=
path
[:
-
5
]
return
path
candidates
=
[]
while
os
.
sep
in
path
:
candidates
.
append
(
path
)
_
,
_
,
path
=
path
.
partition
(
os
.
sep
)
return
candidates
@classmethod
def
file_to_xml
(
cls
,
file_object
):
...
...
common/lib/xmodule/xmodule/xml_module.py
View file @
b29649c4
...
...
@@ -162,10 +162,12 @@ class XmlDescriptor(XModuleDescriptor):
# in the correct format.
# This should go away once the CMS is online and has imported all current (fall 2012)
# courses from xml
if
not
system
.
resources_fs
.
exists
(
filepath
)
and
hasattr
(
cls
,
'backcompat_path'
):
new_filepath
=
cls
.
backcompat_path
(
filepath
)
if
new_filepath
is
not
None
and
system
.
resources_fs
.
exists
(
new_filepath
):
filepath
=
new_filepath
if
not
system
.
resources_fs
.
exists
(
filepath
)
and
hasattr
(
cls
,
'backcompat_paths'
):
candidates
=
cls
.
backcompat_paths
(
filepath
)
for
candidate
in
candidates
:
if
system
.
resources_fs
.
exists
(
candidate
):
filepath
=
candidate
break
log
.
debug
(
'filepath=
%
s, resources_fs=
%
s'
%
(
filepath
,
system
.
resources_fs
))
try
:
...
...
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