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
01f218b7
Commit
01f218b7
authored
Jan 29, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some tab issues from the rebase
parent
9c5fe056
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
22 deletions
+12
-22
lms/djangoapps/courseware/tabs.py
+12
-22
No files found.
lms/djangoapps/courseware/tabs.py
View file @
01f218b7
...
...
@@ -300,27 +300,16 @@ def get_static_tab_by_slug(course, tab_slug):
return
None
def
get_static_tab_contents
(
request
,
cache
,
course
,
tab
):
def
get_static_tab_contents
(
course
,
tab
):
"""
Given a course and a static tab config dict, load the tab contents,
returning None if not found.
loc
=
Location
(
course
.
location
.
tag
,
course
.
location
.
org
,
course
.
location
.
course
,
'static_tab'
,
tab
[
'url_slug'
])
tab_module
=
get_module
(
request
.
user
,
request
,
loc
,
cache
,
course
.
id
)
Looks in tabs/{course_url_name}/{tab_slug}.html first, then tabs/{tab_slug}.html.
"""
slug
=
tab
[
'url_slug'
]
paths
=
[
'tabs/{0}/{1}.html'
.
format
(
course
.
url_name
,
slug
),
'tabs/{0}.html'
.
format
(
slug
)]
fs
=
course
.
system
.
resources_fs
for
p
in
paths
:
if
fs
.
exists
(
p
):
try
:
with
fs
.
open
(
p
)
as
tabfile
:
# TODO: redundant with module_render.py. Want to be helper methods in static_replace or something.
text
=
tabfile
.
read
()
.
decode
(
'utf-8'
)
contents
=
replace_urls
(
text
,
course
.
metadata
[
'data_dir'
])
return
replace_urls
(
contents
,
staticfiles_prefix
=
'/courses/'
+
course
.
id
,
replace_prefix
=
'/course/'
)
except
(
ResourceNotFoundError
)
as
err
:
log
.
exception
(
"Couldn't load tab contents from '{0}': {1}"
.
format
(
p
,
err
))
return
None
return
None
logging
.
debug
(
'course_module = {0}'
.
format
(
tab_module
))
html
=
''
if
tab_module
is
not
None
:
html
=
tab_module
.
get_html
()
return
html
\ No newline at end of file
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