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
ab437b94
Commit
ab437b94
authored
Jan 30, 2013
by
Calen Pennington
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1374 from MITx/feature/cale/no-course-collectstatic
Don't run collectstatic on course content
parents
7a8e87c7
2854d7d0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
106 additions
and
98 deletions
+106
-98
cms/djangoapps/contentstore/views.py
+69
-69
common/lib/xmodule/xmodule/capa_module.py
+5
-5
lms/djangoapps/courseware/courses.py
+2
-3
lms/djangoapps/courseware/module_render.py
+8
-2
lms/envs/common.py
+1
-19
lms/envs/dev.py
+21
-0
No files found.
cms/djangoapps/contentstore/views.py
View file @
ab437b94
...
@@ -132,7 +132,7 @@ def has_access(user, location, role=STAFF_ROLE_NAME):
...
@@ -132,7 +132,7 @@ def has_access(user, location, role=STAFF_ROLE_NAME):
Return True if user allowed to access this piece of data
Return True if user allowed to access this piece of data
Note that the CMS permissions model is with respect to courses
Note that the CMS permissions model is with respect to courses
There is a super-admin permissions if user.is_staff is set
There is a super-admin permissions if user.is_staff is set
Also, since we're unifying the user database between LMS and CAS,
Also, since we're unifying the user database between LMS and CAS,
I'm presuming that the course instructor (formally known as admin)
I'm presuming that the course instructor (formally known as admin)
will not be in both INSTRUCTOR and STAFF groups, so we have to cascade our queries here as INSTRUCTOR
will not be in both INSTRUCTOR and STAFF groups, so we have to cascade our queries here as INSTRUCTOR
has all the rights that STAFF do
has all the rights that STAFF do
...
@@ -154,7 +154,7 @@ def course_index(request, org, course, name):
...
@@ -154,7 +154,7 @@ def course_index(request, org, course, name):
org, course, name: Attributes of the Location for the item to edit
org, course, name: Attributes of the Location for the item to edit
"""
"""
location
=
[
'i4x'
,
org
,
course
,
'course'
,
name
]
location
=
[
'i4x'
,
org
,
course
,
'course'
,
name
]
# check that logged in user has permissions to this item
# check that logged in user has permissions to this item
if
not
has_access
(
request
.
user
,
location
):
if
not
has_access
(
request
.
user
,
location
):
raise
PermissionDenied
()
raise
PermissionDenied
()
...
@@ -213,7 +213,7 @@ def edit_subsection(request, location):
...
@@ -213,7 +213,7 @@ def edit_subsection(request, location):
# remove all metadata from the generic dictionary that is presented in a more normalized UI
# remove all metadata from the generic dictionary that is presented in a more normalized UI
policy_metadata
=
dict
((
key
,
value
)
for
key
,
value
in
item
.
metadata
.
iteritems
()
policy_metadata
=
dict
((
key
,
value
)
for
key
,
value
in
item
.
metadata
.
iteritems
()
if
key
not
in
[
'display_name'
,
'start'
,
'due'
,
'format'
]
and
key
not
in
item
.
system_metadata_fields
)
if
key
not
in
[
'display_name'
,
'start'
,
'due'
,
'format'
]
and
key
not
in
item
.
system_metadata_fields
)
can_view_live
=
False
can_view_live
=
False
...
@@ -292,7 +292,7 @@ def edit_unit(request, location):
...
@@ -292,7 +292,7 @@ def edit_unit(request, location):
containing_section
=
modulestore
()
.
get_item
(
containing_section_locs
[
0
])
containing_section
=
modulestore
()
.
get_item
(
containing_section_locs
[
0
])
# cdodge hack. We're having trouble previewing drafts via jump_to redirect
# cdodge hack. We're having trouble previewing drafts via jump_to redirect
# so let's generate the link url here
# so let's generate the link url here
# need to figure out where this item is in the list of children as the preview will need this
# need to figure out where this item is in the list of children as the preview will need this
index
=
1
index
=
1
...
@@ -303,12 +303,12 @@ def edit_unit(request, location):
...
@@ -303,12 +303,12 @@ def edit_unit(request, location):
preview_lms_link
=
'//{preview}{lms_base}/courses/{org}/{course}/{course_name}/courseware/{section}/{subsection}/{index}'
.
format
(
preview_lms_link
=
'//{preview}{lms_base}/courses/{org}/{course}/{course_name}/courseware/{section}/{subsection}/{index}'
.
format
(
preview
=
'preview.'
,
preview
=
'preview.'
,
lms_base
=
settings
.
LMS_BASE
,
lms_base
=
settings
.
LMS_BASE
,
org
=
course
.
location
.
org
,
org
=
course
.
location
.
org
,
course
=
course
.
location
.
course
,
course
=
course
.
location
.
course
,
course_name
=
course
.
location
.
name
,
course_name
=
course
.
location
.
name
,
section
=
containing_section
.
location
.
name
,
section
=
containing_section
.
location
.
name
,
subsection
=
containing_subsection
.
location
.
name
,
subsection
=
containing_subsection
.
location
.
name
,
index
=
index
)
index
=
index
)
unit_state
=
compute_unit_state
(
item
)
unit_state
=
compute_unit_state
(
item
)
...
@@ -359,14 +359,14 @@ def assignment_type_update(request, org, course, category, name):
...
@@ -359,14 +359,14 @@ def assignment_type_update(request, org, course, category, name):
location
=
Location
([
'i4x'
,
org
,
course
,
category
,
name
])
location
=
Location
([
'i4x'
,
org
,
course
,
category
,
name
])
if
not
has_access
(
request
.
user
,
location
):
if
not
has_access
(
request
.
user
,
location
):
raise
HttpResponseForbidden
()
raise
HttpResponseForbidden
()
if
request
.
method
==
'GET'
:
if
request
.
method
==
'GET'
:
return
HttpResponse
(
json
.
dumps
(
CourseGradingModel
.
get_section_grader_type
(
location
)),
return
HttpResponse
(
json
.
dumps
(
CourseGradingModel
.
get_section_grader_type
(
location
)),
mimetype
=
"application/json"
)
mimetype
=
"application/json"
)
elif
request
.
method
==
'POST'
:
# post or put, doesn't matter.
elif
request
.
method
==
'POST'
:
# post or put, doesn't matter.
return
HttpResponse
(
json
.
dumps
(
CourseGradingModel
.
update_section_grader_type
(
location
,
request
.
POST
)),
return
HttpResponse
(
json
.
dumps
(
CourseGradingModel
.
update_section_grader_type
(
location
,
request
.
POST
)),
mimetype
=
"application/json"
)
mimetype
=
"application/json"
)
def
user_author_string
(
user
):
def
user_author_string
(
user
):
'''Get an author string for commits by this user. Format:
'''Get an author string for commits by this user. Format:
...
@@ -511,23 +511,23 @@ def load_preview_module(request, preview_id, descriptor, instance_state, shared_
...
@@ -511,23 +511,23 @@ def load_preview_module(request, preview_id, descriptor, instance_state, shared_
error_msg
=
exc_info_to_str
(
sys
.
exc_info
())
error_msg
=
exc_info_to_str
(
sys
.
exc_info
())
)
.
xmodule_constructor
(
system
)(
None
,
None
)
)
.
xmodule_constructor
(
system
)(
None
,
None
)
# cdodge: Special case
# cdodge: Special case
if
module
.
location
.
category
==
'static_tab'
:
if
module
.
location
.
category
==
'static_tab'
:
module
.
get_html
=
wrap_xmodule
(
module
.
get_html
=
wrap_xmodule
(
module
.
get_html
,
module
.
get_html
,
module
,
module
,
"xmodule_tab_display.html"
,
"xmodule_tab_display.html"
,
)
)
else
:
else
:
module
.
get_html
=
wrap_xmodule
(
module
.
get_html
=
wrap_xmodule
(
module
.
get_html
,
module
.
get_html
,
module
,
module
,
"xmodule_display.html"
,
"xmodule_display.html"
,
)
)
module
.
get_html
=
replace_static_urls
(
module
.
get_html
=
replace_static_urls
(
module
.
get_html
,
module
.
get_html
,
module
.
metadata
.
get
(
'data_dir'
,
module
.
location
.
course
),
'/static/'
+
module
.
metadata
.
get
(
'data_dir'
,
module
.
location
.
course
),
course_namespace
=
Location
([
module
.
location
.
tag
,
module
.
location
.
org
,
module
.
location
.
course
,
None
,
None
])
course_namespace
=
Location
([
module
.
location
.
tag
,
module
.
location
.
org
,
module
.
location
.
course
,
None
,
None
])
)
)
save_preview_state
(
request
,
preview_id
,
descriptor
.
location
.
url
(),
save_preview_state
(
request
,
preview_id
,
descriptor
.
location
.
url
(),
...
@@ -555,7 +555,7 @@ def _xmodule_recurse(item, action):
...
@@ -555,7 +555,7 @@ def _xmodule_recurse(item, action):
_xmodule_recurse
(
child
,
action
)
_xmodule_recurse
(
child
,
action
)
action
(
item
)
action
(
item
)
@login_required
@login_required
@expect_json
@expect_json
...
@@ -590,7 +590,7 @@ def delete_item(request):
...
@@ -590,7 +590,7 @@ def delete_item(request):
# delete_item on a vertical tries to delete the draft version leaving the
# delete_item on a vertical tries to delete the draft version leaving the
# requested delete to never occur
# requested delete to never occur
if
item
.
location
.
revision
is
None
and
item
.
location
.
category
==
'vertical'
and
delete_all_versions
:
if
item
.
location
.
revision
is
None
and
item
.
location
.
category
==
'vertical'
and
delete_all_versions
:
modulestore
(
'direct'
)
.
delete_item
(
item
.
location
)
modulestore
(
'direct'
)
.
delete_item
(
item
.
location
)
return
HttpResponse
()
return
HttpResponse
()
...
@@ -609,7 +609,7 @@ def save_item(request):
...
@@ -609,7 +609,7 @@ def save_item(request):
if
request
.
POST
.
get
(
'data'
)
is
not
None
:
if
request
.
POST
.
get
(
'data'
)
is
not
None
:
data
=
request
.
POST
[
'data'
]
data
=
request
.
POST
[
'data'
]
store
.
update_item
(
item_location
,
data
)
store
.
update_item
(
item_location
,
data
)
# cdodge: note calling request.POST.get('children') will return None if children is an empty array
# cdodge: note calling request.POST.get('children') will return None if children is an empty array
# so it lead to a bug whereby the last component to be deleted in the UI was not actually
# so it lead to a bug whereby the last component to be deleted in the UI was not actually
# deleting the children object from the children collection
# deleting the children object from the children collection
...
@@ -699,7 +699,7 @@ def unpublish_unit(request):
...
@@ -699,7 +699,7 @@ def unpublish_unit(request):
def
clone_item
(
request
):
def
clone_item
(
request
):
parent_location
=
Location
(
request
.
POST
[
'parent_location'
])
parent_location
=
Location
(
request
.
POST
[
'parent_location'
])
template
=
Location
(
request
.
POST
[
'template'
])
template
=
Location
(
request
.
POST
[
'template'
])
display_name
=
request
.
POST
.
get
(
'display_name'
)
display_name
=
request
.
POST
.
get
(
'display_name'
)
if
not
has_access
(
request
.
user
,
parent_location
):
if
not
has_access
(
request
.
user
,
parent_location
):
...
@@ -739,9 +739,9 @@ def upload_asset(request, org, course, coursename):
...
@@ -739,9 +739,9 @@ def upload_asset(request, org, course, coursename):
location
=
[
'i4x'
,
org
,
course
,
'course'
,
coursename
]
location
=
[
'i4x'
,
org
,
course
,
'course'
,
coursename
]
if
not
has_access
(
request
.
user
,
location
):
if
not
has_access
(
request
.
user
,
location
):
return
HttpResponseForbidden
()
return
HttpResponseForbidden
()
# Does the course actually exist?!? Get anything from it to prove its existance
# Does the course actually exist?!? Get anything from it to prove its existance
try
:
try
:
item
=
modulestore
()
.
get_item
(
location
)
item
=
modulestore
()
.
get_item
(
location
)
except
:
except
:
...
@@ -775,9 +775,9 @@ def upload_asset(request, org, course, coursename):
...
@@ -775,9 +775,9 @@ def upload_asset(request, org, course, coursename):
# readback the saved content - we need the database timestamp
# readback the saved content - we need the database timestamp
readback
=
contentstore
()
.
find
(
content
.
location
)
readback
=
contentstore
()
.
find
(
content
.
location
)
response_payload
=
{
'displayname'
:
content
.
name
,
response_payload
=
{
'displayname'
:
content
.
name
,
'uploadDate'
:
get_date_display
(
readback
.
last_modified_at
),
'uploadDate'
:
get_date_display
(
readback
.
last_modified_at
),
'url'
:
StaticContent
.
get_url_path_from_location
(
content
.
location
),
'url'
:
StaticContent
.
get_url_path_from_location
(
content
.
location
),
'thumb_url'
:
StaticContent
.
get_url_path_from_location
(
thumbnail_location
)
if
thumbnail_content
is
not
None
else
None
,
'thumb_url'
:
StaticContent
.
get_url_path_from_location
(
thumbnail_location
)
if
thumbnail_content
is
not
None
else
None
,
'msg'
:
'Upload completed'
'msg'
:
'Upload completed'
...
@@ -793,7 +793,7 @@ This view will return all CMS users who are editors for the specified course
...
@@ -793,7 +793,7 @@ This view will return all CMS users who are editors for the specified course
@login_required
@login_required
@ensure_csrf_cookie
@ensure_csrf_cookie
def
manage_users
(
request
,
location
):
def
manage_users
(
request
,
location
):
# check that logged in user has permissions to this item
# check that logged in user has permissions to this item
if
not
has_access
(
request
.
user
,
location
,
role
=
INSTRUCTOR_ROLE_NAME
)
and
not
has_access
(
request
.
user
,
location
,
role
=
STAFF_ROLE_NAME
):
if
not
has_access
(
request
.
user
,
location
,
role
=
INSTRUCTOR_ROLE_NAME
)
and
not
has_access
(
request
.
user
,
location
,
role
=
STAFF_ROLE_NAME
):
raise
PermissionDenied
()
raise
PermissionDenied
()
...
@@ -809,7 +809,7 @@ def manage_users(request, location):
...
@@ -809,7 +809,7 @@ def manage_users(request, location):
'allow_actions'
:
has_access
(
request
.
user
,
location
,
role
=
INSTRUCTOR_ROLE_NAME
),
'allow_actions'
:
has_access
(
request
.
user
,
location
,
role
=
INSTRUCTOR_ROLE_NAME
),
'request_user_id'
:
request
.
user
.
id
'request_user_id'
:
request
.
user
.
id
})
})
def
create_json_response
(
errmsg
=
None
):
def
create_json_response
(
errmsg
=
None
):
if
errmsg
is
not
None
:
if
errmsg
is
not
None
:
...
@@ -831,13 +831,13 @@ def add_user(request, location):
...
@@ -831,13 +831,13 @@ def add_user(request, location):
if
email
==
''
:
if
email
==
''
:
return
create_json_response
(
'Please specify an email address.'
)
return
create_json_response
(
'Please specify an email address.'
)
# check that logged in user has admin permissions to this course
# check that logged in user has admin permissions to this course
if
not
has_access
(
request
.
user
,
location
,
role
=
INSTRUCTOR_ROLE_NAME
):
if
not
has_access
(
request
.
user
,
location
,
role
=
INSTRUCTOR_ROLE_NAME
):
raise
PermissionDenied
()
raise
PermissionDenied
()
user
=
get_user_by_email
(
email
)
user
=
get_user_by_email
(
email
)
# user doesn't exist?!? Return error.
# user doesn't exist?!? Return error.
if
user
is
None
:
if
user
is
None
:
return
create_json_response
(
'Could not find user by email address
\'
{0}
\'
.'
.
format
(
email
))
return
create_json_response
(
'Could not find user by email address
\'
{0}
\'
.'
.
format
(
email
))
...
@@ -860,7 +860,7 @@ the specified course
...
@@ -860,7 +860,7 @@ the specified course
@ensure_csrf_cookie
@ensure_csrf_cookie
def
remove_user
(
request
,
location
):
def
remove_user
(
request
,
location
):
email
=
request
.
POST
[
"email"
]
email
=
request
.
POST
[
"email"
]
# check that logged in user has admin permissions on this course
# check that logged in user has admin permissions on this course
if
not
has_access
(
request
.
user
,
location
,
role
=
INSTRUCTOR_ROLE_NAME
):
if
not
has_access
(
request
.
user
,
location
,
role
=
INSTRUCTOR_ROLE_NAME
):
raise
PermissionDenied
()
raise
PermissionDenied
()
...
@@ -887,7 +887,7 @@ def landing(request, org, course, coursename):
...
@@ -887,7 +887,7 @@ def landing(request, org, course, coursename):
def
static_pages
(
request
,
org
,
course
,
coursename
):
def
static_pages
(
request
,
org
,
course
,
coursename
):
location
=
[
'i4x'
,
org
,
course
,
'course'
,
coursename
]
location
=
[
'i4x'
,
org
,
course
,
'course'
,
coursename
]
# check that logged in user has permissions to this item
# check that logged in user has permissions to this item
if
not
has_access
(
request
.
user
,
location
):
if
not
has_access
(
request
.
user
,
location
):
raise
PermissionDenied
()
raise
PermissionDenied
()
...
@@ -952,7 +952,7 @@ def reorder_static_tabs(request):
...
@@ -952,7 +952,7 @@ def reorder_static_tabs(request):
@login_required
@login_required
@ensure_csrf_cookie
@ensure_csrf_cookie
def
edit_tabs
(
request
,
org
,
course
,
coursename
):
def
edit_tabs
(
request
,
org
,
course
,
coursename
):
location
=
[
'i4x'
,
org
,
course
,
'course'
,
coursename
]
location
=
[
'i4x'
,
org
,
course
,
'course'
,
coursename
]
course_item
=
modulestore
()
.
get_item
(
location
)
course_item
=
modulestore
()
.
get_item
(
location
)
static_tabs_loc
=
Location
(
'i4x'
,
org
,
course
,
'static_tab'
,
None
)
static_tabs_loc
=
Location
(
'i4x'
,
org
,
course
,
'static_tab'
,
None
)
...
@@ -981,7 +981,7 @@ def edit_tabs(request, org, course, coursename):
...
@@ -981,7 +981,7 @@ def edit_tabs(request, org, course, coursename):
return
render_to_response
(
'edit-tabs.html'
,
{
return
render_to_response
(
'edit-tabs.html'
,
{
'active_tab'
:
'pages'
,
'active_tab'
:
'pages'
,
'context_course'
:
course_item
,
'context_course'
:
course_item
,
'components'
:
components
'components'
:
components
})
})
...
@@ -1002,13 +1002,13 @@ def course_info(request, org, course, name, provided_id=None):
...
@@ -1002,13 +1002,13 @@ def course_info(request, org, course, name, provided_id=None):
org, course, name: Attributes of the Location for the item to edit
org, course, name: Attributes of the Location for the item to edit
"""
"""
location
=
[
'i4x'
,
org
,
course
,
'course'
,
name
]
location
=
[
'i4x'
,
org
,
course
,
'course'
,
name
]
# check that logged in user has permissions to this item
# check that logged in user has permissions to this item
if
not
has_access
(
request
.
user
,
location
):
if
not
has_access
(
request
.
user
,
location
):
raise
PermissionDenied
()
raise
PermissionDenied
()
course_module
=
modulestore
()
.
get_item
(
location
)
course_module
=
modulestore
()
.
get_item
(
location
)
# get current updates
# get current updates
location
=
[
'i4x'
,
org
,
course
,
'course_info'
,
"updates"
]
location
=
[
'i4x'
,
org
,
course
,
'course_info'
,
"updates"
]
...
@@ -1019,7 +1019,7 @@ def course_info(request, org, course, name, provided_id=None):
...
@@ -1019,7 +1019,7 @@ def course_info(request, org, course, name, provided_id=None):
'course_updates'
:
json
.
dumps
(
get_course_updates
(
location
)),
'course_updates'
:
json
.
dumps
(
get_course_updates
(
location
)),
'handouts_location'
:
Location
([
'i4x'
,
org
,
course
,
'course_info'
,
'handouts'
])
.
url
()
'handouts_location'
:
Location
([
'i4x'
,
org
,
course
,
'course_info'
,
'handouts'
])
.
url
()
})
})
@expect_json
@expect_json
@login_required
@login_required
@ensure_csrf_cookie
@ensure_csrf_cookie
...
@@ -1033,7 +1033,7 @@ def course_info_updates(request, org, course, provided_id=None):
...
@@ -1033,7 +1033,7 @@ def course_info_updates(request, org, course, provided_id=None):
# ??? No way to check for access permission afaik
# ??? No way to check for access permission afaik
# get current updates
# get current updates
location
=
[
'i4x'
,
org
,
course
,
'course_info'
,
"updates"
]
location
=
[
'i4x'
,
org
,
course
,
'course_info'
,
"updates"
]
# Hmmm, provided_id is coming as empty string on create whereas I believe it used to be None :-(
# Hmmm, provided_id is coming as empty string on create whereas I believe it used to be None :-(
# Possibly due to my removing the seemingly redundant pattern in urls.py
# Possibly due to my removing the seemingly redundant pattern in urls.py
if
provided_id
==
''
:
if
provided_id
==
''
:
...
@@ -1048,7 +1048,7 @@ def course_info_updates(request, org, course, provided_id=None):
...
@@ -1048,7 +1048,7 @@ def course_info_updates(request, org, course, provided_id=None):
real_method
=
request
.
META
[
'HTTP_X_HTTP_METHOD_OVERRIDE'
]
real_method
=
request
.
META
[
'HTTP_X_HTTP_METHOD_OVERRIDE'
]
else
:
else
:
real_method
=
request
.
method
real_method
=
request
.
method
if
request
.
method
==
'GET'
:
if
request
.
method
==
'GET'
:
return
HttpResponse
(
json
.
dumps
(
get_course_updates
(
location
)),
mimetype
=
"application/json"
)
return
HttpResponse
(
json
.
dumps
(
get_course_updates
(
location
)),
mimetype
=
"application/json"
)
elif
real_method
==
'DELETE'
:
# coming as POST need to pull from Request Header X-HTTP-Method-Override DELETE
elif
real_method
==
'DELETE'
:
# coming as POST need to pull from Request Header X-HTTP-Method-Override DELETE
...
@@ -1065,7 +1065,7 @@ def course_info_updates(request, org, course, provided_id=None):
...
@@ -1065,7 +1065,7 @@ def course_info_updates(request, org, course, provided_id=None):
@ensure_csrf_cookie
@ensure_csrf_cookie
def
module_info
(
request
,
module_location
):
def
module_info
(
request
,
module_location
):
location
=
Location
(
module_location
)
location
=
Location
(
module_location
)
# check that logged in user has permissions to this item
# check that logged in user has permissions to this item
if
not
has_access
(
request
.
user
,
location
):
if
not
has_access
(
request
.
user
,
location
):
raise
PermissionDenied
()
raise
PermissionDenied
()
...
@@ -1078,10 +1078,10 @@ def module_info(request, module_location):
...
@@ -1078,10 +1078,10 @@ def module_info(request, module_location):
rewrite_static_links
=
request
.
GET
.
get
(
'rewrite_url_links'
,
'True'
)
in
[
'True'
,
'true'
]
rewrite_static_links
=
request
.
GET
.
get
(
'rewrite_url_links'
,
'True'
)
in
[
'True'
,
'true'
]
logging
.
debug
(
'rewrite_static_links = {0} {1}'
.
format
(
request
.
GET
.
get
(
'rewrite_url_links'
,
'False'
),
rewrite_static_links
))
logging
.
debug
(
'rewrite_static_links = {0} {1}'
.
format
(
request
.
GET
.
get
(
'rewrite_url_links'
,
'False'
),
rewrite_static_links
))
# check that logged in user has permissions to this item
# check that logged in user has permissions to this item
if
not
has_access
(
request
.
user
,
location
):
if
not
has_access
(
request
.
user
,
location
):
raise
PermissionDenied
()
raise
PermissionDenied
()
if
real_method
==
'GET'
:
if
real_method
==
'GET'
:
return
HttpResponse
(
json
.
dumps
(
get_module_info
(
get_modulestore
(
location
),
location
,
rewrite_static_links
=
rewrite_static_links
)),
mimetype
=
"application/json"
)
return
HttpResponse
(
json
.
dumps
(
get_module_info
(
get_modulestore
(
location
),
location
,
rewrite_static_links
=
rewrite_static_links
)),
mimetype
=
"application/json"
)
...
@@ -1099,20 +1099,20 @@ def get_course_settings(request, org, course, name):
...
@@ -1099,20 +1099,20 @@ def get_course_settings(request, org, course, name):
org, course, name: Attributes of the Location for the item to edit
org, course, name: Attributes of the Location for the item to edit
"""
"""
location
=
[
'i4x'
,
org
,
course
,
'course'
,
name
]
location
=
[
'i4x'
,
org
,
course
,
'course'
,
name
]
# check that logged in user has permissions to this item
# check that logged in user has permissions to this item
if
not
has_access
(
request
.
user
,
location
):
if
not
has_access
(
request
.
user
,
location
):
raise
PermissionDenied
()
raise
PermissionDenied
()
course_module
=
modulestore
()
.
get_item
(
location
)
course_module
=
modulestore
()
.
get_item
(
location
)
course_details
=
CourseDetails
.
fetch
(
location
)
course_details
=
CourseDetails
.
fetch
(
location
)
return
render_to_response
(
'settings.html'
,
{
return
render_to_response
(
'settings.html'
,
{
'active_tab'
:
'settings'
,
'active_tab'
:
'settings'
,
'context_course'
:
course_module
,
'context_course'
:
course_module
,
'course_details'
:
json
.
dumps
(
course_details
,
cls
=
CourseSettingsEncoder
)
'course_details'
:
json
.
dumps
(
course_details
,
cls
=
CourseSettingsEncoder
)
})
})
@expect_json
@expect_json
@login_required
@login_required
@ensure_csrf_cookie
@ensure_csrf_cookie
...
@@ -1135,13 +1135,13 @@ def course_settings_updates(request, org, course, name, section):
...
@@ -1135,13 +1135,13 @@ def course_settings_updates(request, org, course, name, section):
elif
section
==
'grading'
:
elif
section
==
'grading'
:
manager
=
CourseGradingModel
manager
=
CourseGradingModel
else
:
return
else
:
return
if
request
.
method
==
'GET'
:
if
request
.
method
==
'GET'
:
# Cannot just do a get w/o knowing the course name :-(
# Cannot just do a get w/o knowing the course name :-(
return
HttpResponse
(
json
.
dumps
(
manager
.
fetch
(
Location
([
'i4x'
,
org
,
course
,
'course'
,
name
])),
cls
=
CourseSettingsEncoder
),
return
HttpResponse
(
json
.
dumps
(
manager
.
fetch
(
Location
([
'i4x'
,
org
,
course
,
'course'
,
name
])),
cls
=
CourseSettingsEncoder
),
mimetype
=
"application/json"
)
mimetype
=
"application/json"
)
elif
request
.
method
==
'POST'
:
# post or put, doesn't matter.
elif
request
.
method
==
'POST'
:
# post or put, doesn't matter.
return
HttpResponse
(
json
.
dumps
(
manager
.
update_from_json
(
request
.
POST
),
cls
=
CourseSettingsEncoder
),
return
HttpResponse
(
json
.
dumps
(
manager
.
update_from_json
(
request
.
POST
),
cls
=
CourseSettingsEncoder
),
mimetype
=
"application/json"
)
mimetype
=
"application/json"
)
@expect_json
@expect_json
...
@@ -1154,7 +1154,7 @@ def course_grader_updates(request, org, course, name, grader_index=None):
...
@@ -1154,7 +1154,7 @@ def course_grader_updates(request, org, course, name, grader_index=None):
org, course: Attributes of the Location for the item to edit
org, course: Attributes of the Location for the item to edit
"""
"""
location
=
[
'i4x'
,
org
,
course
,
'course'
,
name
]
location
=
[
'i4x'
,
org
,
course
,
'course'
,
name
]
# check that logged in user has permissions to this item
# check that logged in user has permissions to this item
...
@@ -1165,13 +1165,13 @@ def course_grader_updates(request, org, course, name, grader_index=None):
...
@@ -1165,13 +1165,13 @@ def course_grader_updates(request, org, course, name, grader_index=None):
real_method
=
request
.
META
[
'HTTP_X_HTTP_METHOD_OVERRIDE'
]
real_method
=
request
.
META
[
'HTTP_X_HTTP_METHOD_OVERRIDE'
]
else
:
else
:
real_method
=
request
.
method
real_method
=
request
.
method
if
real_method
==
'GET'
:
if
real_method
==
'GET'
:
# Cannot just do a get w/o knowing the course name :-(
# Cannot just do a get w/o knowing the course name :-(
return
HttpResponse
(
json
.
dumps
(
CourseGradingModel
.
fetch_grader
(
Location
([
'i4x'
,
org
,
course
,
'course'
,
name
]),
grader_index
)),
return
HttpResponse
(
json
.
dumps
(
CourseGradingModel
.
fetch_grader
(
Location
([
'i4x'
,
org
,
course
,
'course'
,
name
]),
grader_index
)),
mimetype
=
"application/json"
)
mimetype
=
"application/json"
)
elif
real_method
==
"DELETE"
:
elif
real_method
==
"DELETE"
:
# ??? Shoudl this return anything? Perhaps success fail?
# ??? Shoudl this return anything? Perhaps success fail?
CourseGradingModel
.
delete_grader
(
Location
([
'i4x'
,
org
,
course
,
'course'
,
name
]),
grader_index
)
CourseGradingModel
.
delete_grader
(
Location
([
'i4x'
,
org
,
course
,
'course'
,
name
]),
grader_index
)
return
HttpResponse
()
return
HttpResponse
()
elif
request
.
method
==
'POST'
:
# post or put, doesn't matter.
elif
request
.
method
==
'POST'
:
# post or put, doesn't matter.
...
@@ -1188,7 +1188,7 @@ def asset_index(request, org, course, name):
...
@@ -1188,7 +1188,7 @@ def asset_index(request, org, course, name):
org, course, name: Attributes of the Location for the item to edit
org, course, name: Attributes of the Location for the item to edit
"""
"""
location
=
[
'i4x'
,
org
,
course
,
'course'
,
name
]
location
=
[
'i4x'
,
org
,
course
,
'course'
,
name
]
# check that logged in user has permissions to this item
# check that logged in user has permissions to this item
if
not
has_access
(
request
.
user
,
location
):
if
not
has_access
(
request
.
user
,
location
):
raise
PermissionDenied
()
raise
PermissionDenied
()
...
@@ -1201,7 +1201,7 @@ def asset_index(request, org, course, name):
...
@@ -1201,7 +1201,7 @@ def asset_index(request, org, course, name):
})
})
course_module
=
modulestore
()
.
get_item
(
location
)
course_module
=
modulestore
()
.
get_item
(
location
)
course_reference
=
StaticContent
.
compute_location
(
org
,
course
,
name
)
course_reference
=
StaticContent
.
compute_location
(
org
,
course
,
name
)
assets
=
contentstore
()
.
get_all_content_for_course
(
course_reference
)
assets
=
contentstore
()
.
get_all_content_for_course
(
course_reference
)
...
@@ -1215,15 +1215,15 @@ def asset_index(request, org, course, name):
...
@@ -1215,15 +1215,15 @@ def asset_index(request, org, course, name):
display_info
=
{}
display_info
=
{}
display_info
[
'displayname'
]
=
asset
[
'displayname'
]
display_info
[
'displayname'
]
=
asset
[
'displayname'
]
display_info
[
'uploadDate'
]
=
get_date_display
(
asset
[
'uploadDate'
])
display_info
[
'uploadDate'
]
=
get_date_display
(
asset
[
'uploadDate'
])
asset_location
=
StaticContent
.
compute_location
(
id
[
'org'
],
id
[
'course'
],
id
[
'name'
])
asset_location
=
StaticContent
.
compute_location
(
id
[
'org'
],
id
[
'course'
],
id
[
'name'
])
display_info
[
'url'
]
=
StaticContent
.
get_url_path_from_location
(
asset_location
)
display_info
[
'url'
]
=
StaticContent
.
get_url_path_from_location
(
asset_location
)
# note, due to the schema change we may not have a 'thumbnail_location' in the result set
# note, due to the schema change we may not have a 'thumbnail_location' in the result set
_thumbnail_location
=
asset
.
get
(
'thumbnail_location'
,
None
)
_thumbnail_location
=
asset
.
get
(
'thumbnail_location'
,
None
)
thumbnail_location
=
Location
(
_thumbnail_location
)
if
_thumbnail_location
is
not
None
else
None
thumbnail_location
=
Location
(
_thumbnail_location
)
if
_thumbnail_location
is
not
None
else
None
display_info
[
'thumb_url'
]
=
StaticContent
.
get_url_path_from_location
(
thumbnail_location
)
if
thumbnail_location
is
not
None
else
None
display_info
[
'thumb_url'
]
=
StaticContent
.
get_url_path_from_location
(
thumbnail_location
)
if
thumbnail_location
is
not
None
else
None
asset_display
.
append
(
display_info
)
asset_display
.
append
(
display_info
)
return
render_to_response
(
'asset_index.html'
,
{
return
render_to_response
(
'asset_index.html'
,
{
...
@@ -1242,9 +1242,9 @@ def edge(request):
...
@@ -1242,9 +1242,9 @@ def edge(request):
@expect_json
@expect_json
def
create_new_course
(
request
):
def
create_new_course
(
request
):
template
=
Location
(
request
.
POST
[
'template'
])
template
=
Location
(
request
.
POST
[
'template'
])
org
=
request
.
POST
.
get
(
'org'
)
org
=
request
.
POST
.
get
(
'org'
)
number
=
request
.
POST
.
get
(
'number'
)
number
=
request
.
POST
.
get
(
'number'
)
display_name
=
request
.
POST
.
get
(
'display_name'
)
display_name
=
request
.
POST
.
get
(
'display_name'
)
try
:
try
:
dest_location
=
Location
(
'i4x'
,
org
,
number
,
'course'
,
Location
.
clean
(
display_name
))
dest_location
=
Location
(
'i4x'
,
org
,
number
,
'course'
,
Location
.
clean
(
display_name
))
...
@@ -1290,13 +1290,13 @@ def initialize_course_tabs(course):
...
@@ -1290,13 +1290,13 @@ def initialize_course_tabs(course):
# at least a list populated with the minimal times
# at least a list populated with the minimal times
# @TODO: I don't like the fact that the presentation tier is away of these data related constraints, let's find a better
# @TODO: I don't like the fact that the presentation tier is away of these data related constraints, let's find a better
# place for this. Also rather than using a simple list of dictionaries a nice class model would be helpful here
# place for this. Also rather than using a simple list of dictionaries a nice class model would be helpful here
course
.
tabs
=
[{
"type"
:
"courseware"
},
course
.
tabs
=
[{
"type"
:
"courseware"
},
{
"type"
:
"course_info"
,
"name"
:
"Course Info"
},
{
"type"
:
"course_info"
,
"name"
:
"Course Info"
},
{
"type"
:
"discussion"
,
"name"
:
"Discussion"
},
{
"type"
:
"discussion"
,
"name"
:
"Discussion"
},
{
"type"
:
"wiki"
,
"name"
:
"Wiki"
},
{
"type"
:
"wiki"
,
"name"
:
"Wiki"
},
{
"type"
:
"progress"
,
"name"
:
"Progress"
}]
{
"type"
:
"progress"
,
"name"
:
"Progress"
}]
modulestore
(
'direct'
)
.
update_metadata
(
course
.
location
.
url
(),
course
.
own_metadata
)
modulestore
(
'direct'
)
.
update_metadata
(
course
.
location
.
url
(),
course
.
own_metadata
)
@ensure_csrf_cookie
@ensure_csrf_cookie
@login_required
@login_required
...
@@ -1390,7 +1390,7 @@ def generate_export_course(request, org, course, name):
...
@@ -1390,7 +1390,7 @@ def generate_export_course(request, org, course, name):
root_dir
=
path
(
mkdtemp
())
root_dir
=
path
(
mkdtemp
())
# export out to a tempdir
# export out to a tempdir
logging
.
debug
(
'root = {0}'
.
format
(
root_dir
))
logging
.
debug
(
'root = {0}'
.
format
(
root_dir
))
export_to_xml
(
modulestore
(
'direct'
),
contentstore
(),
loc
,
root_dir
,
name
)
export_to_xml
(
modulestore
(
'direct'
),
contentstore
(),
loc
,
root_dir
,
name
)
...
@@ -1402,7 +1402,7 @@ def generate_export_course(request, org, course, name):
...
@@ -1402,7 +1402,7 @@ def generate_export_course(request, org, course, name):
tf
.
close
()
tf
.
close
()
# remove temp dir
# remove temp dir
shutil
.
rmtree
(
root_dir
/
name
)
shutil
.
rmtree
(
root_dir
/
name
)
wrapper
=
FileWrapper
(
export_file
)
wrapper
=
FileWrapper
(
export_file
)
response
=
HttpResponse
(
wrapper
,
content_type
=
'application/x-tgz'
)
response
=
HttpResponse
(
wrapper
,
content_type
=
'application/x-tgz'
)
...
...
common/lib/xmodule/xmodule/capa_module.py
View file @
ab437b94
...
@@ -356,7 +356,7 @@ class CapaModule(XModule):
...
@@ -356,7 +356,7 @@ class CapaModule(XModule):
id
=
self
.
location
.
html_id
(),
ajax_url
=
self
.
system
.
ajax_url
)
+
html
+
"</div>"
id
=
self
.
location
.
html_id
(),
ajax_url
=
self
.
system
.
ajax_url
)
+
html
+
"</div>"
# now do the substitutions which are filesystem based, e.g. '/static/' prefixes
# now do the substitutions which are filesystem based, e.g. '/static/' prefixes
return
self
.
system
.
replace_urls
(
html
,
self
.
metadata
[
'data_dir'
],
course_namespace
=
self
.
location
)
return
self
.
system
.
replace_urls
(
html
)
def
handle_ajax
(
self
,
dispatch
,
get
):
def
handle_ajax
(
self
,
dispatch
,
get
):
'''
'''
...
@@ -461,7 +461,7 @@ class CapaModule(XModule):
...
@@ -461,7 +461,7 @@ class CapaModule(XModule):
new_answers
=
dict
()
new_answers
=
dict
()
for
answer_id
in
answers
:
for
answer_id
in
answers
:
try
:
try
:
new_answer
=
{
answer_id
:
self
.
system
.
replace_urls
(
answers
[
answer_id
]
,
self
.
metadata
[
'data_dir'
],
course_namespace
=
self
.
location
)}
new_answer
=
{
answer_id
:
self
.
system
.
replace_urls
(
answers
[
answer_id
])}
except
TypeError
:
except
TypeError
:
log
.
debug
(
'Unable to perform URL substitution on answers[
%
s]:
%
s'
%
(
answer_id
,
answers
[
answer_id
]))
log
.
debug
(
'Unable to perform URL substitution on answers[
%
s]:
%
s'
%
(
answer_id
,
answers
[
answer_id
]))
new_answer
=
{
answer_id
:
answers
[
answer_id
]}
new_answer
=
{
answer_id
:
answers
[
answer_id
]}
...
@@ -669,18 +669,18 @@ class CapaDescriptor(RawDescriptor):
...
@@ -669,18 +669,18 @@ class CapaDescriptor(RawDescriptor):
# TODO (vshnayder): do problems have any other metadata? Do they
# TODO (vshnayder): do problems have any other metadata? Do they
# actually use type and points?
# actually use type and points?
metadata_attributes
=
RawDescriptor
.
metadata_attributes
+
(
'type'
,
'points'
)
metadata_attributes
=
RawDescriptor
.
metadata_attributes
+
(
'type'
,
'points'
)
def
get_context
(
self
):
def
get_context
(
self
):
_context
=
RawDescriptor
.
get_context
(
self
)
_context
=
RawDescriptor
.
get_context
(
self
)
_context
.
update
({
'markdown'
:
self
.
metadata
.
get
(
'markdown'
,
''
)})
_context
.
update
({
'markdown'
:
self
.
metadata
.
get
(
'markdown'
,
''
)})
return
_context
return
_context
@property
@property
def
editable_metadata_fields
(
self
):
def
editable_metadata_fields
(
self
):
"""Remove metadata from the editable fields since it has its own editor"""
"""Remove metadata from the editable fields since it has its own editor"""
subset
=
super
(
CapaDescriptor
,
self
)
.
editable_metadata_fields
subset
=
super
(
CapaDescriptor
,
self
)
.
editable_metadata_fields
if
'markdown'
in
subset
:
if
'markdown'
in
subset
:
subset
.
remove
(
'markdown'
)
subset
.
remove
(
'markdown'
)
return
subset
return
subset
...
...
lms/djangoapps/courseware/courses.py
View file @
ab437b94
...
@@ -83,13 +83,12 @@ def get_opt_course_with_access(user, course_id, action):
...
@@ -83,13 +83,12 @@ def get_opt_course_with_access(user, course_id, action):
return
None
return
None
return
get_course_with_access
(
user
,
course_id
,
action
)
return
get_course_with_access
(
user
,
course_id
,
action
)
def
course_image_url
(
course
):
def
course_image_url
(
course
):
"""Try to look up the image url for the course. If it's not found,
"""Try to look up the image url for the course. If it's not found,
log an error and return the dead link"""
log an error and return the dead link"""
if
isinstance
(
modulestore
(),
XMLModuleStore
):
if
isinstance
(
modulestore
(),
XMLModuleStore
):
path
=
course
.
metadata
[
'data_dir'
]
+
"/images/course_image.jpg"
return
'/static/'
+
course
.
metadata
[
'data_dir'
]
+
"/images/course_image.jpg"
return
try_staticfiles_lookup
(
path
)
else
:
else
:
loc
=
course
.
location
.
_replace
(
tag
=
'c4x'
,
category
=
'asset'
,
name
=
'images_course_image.jpg'
)
loc
=
course
.
location
.
_replace
(
tag
=
'c4x'
,
category
=
'asset'
,
name
=
'images_course_image.jpg'
)
path
=
StaticContent
.
get_url_path_from_location
(
loc
)
path
=
StaticContent
.
get_url_path_from_location
(
loc
)
...
...
lms/djangoapps/courseware/module_render.py
View file @
ab437b94
...
@@ -3,6 +3,8 @@ import logging
...
@@ -3,6 +3,8 @@ import logging
import
pyparsing
import
pyparsing
import
sys
import
sys
from
functools
import
partial
from
django.conf
import
settings
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
...
@@ -244,7 +246,11 @@ def _get_module(user, request, descriptor, student_module_cache, course_id,
...
@@ -244,7 +246,11 @@ def _get_module(user, request, descriptor, student_module_cache, course_id,
# TODO (cpennington): This should be removed when all html from
# TODO (cpennington): This should be removed when all html from
# a module is coming through get_html and is therefore covered
# a module is coming through get_html and is therefore covered
# by the replace_static_urls code below
# by the replace_static_urls code below
replace_urls
=
replace_urls
,
replace_urls
=
partial
(
replace_urls
,
staticfiles_prefix
=
'/static/'
+
descriptor
.
metadata
.
get
(
'data_dir'
,
''
),
course_namespace
=
descriptor
.
location
.
_replace
(
category
=
None
,
name
=
None
),
),
node_path
=
settings
.
NODE_PATH
,
node_path
=
settings
.
NODE_PATH
,
anonymous_student_id
=
unique_id_for_user
(
user
),
anonymous_student_id
=
unique_id_for_user
(
user
),
course_id
=
course_id
,
course_id
=
course_id
,
...
@@ -280,7 +286,7 @@ def _get_module(user, request, descriptor, student_module_cache, course_id,
...
@@ -280,7 +286,7 @@ def _get_module(user, request, descriptor, student_module_cache, course_id,
module
.
get_html
=
replace_static_urls
(
module
.
get_html
=
replace_static_urls
(
_get_html
,
_get_html
,
module
.
metadata
[
'data_dir'
]
if
'data_dir'
in
module
.
metadata
else
''
,
'/static/'
+
module
.
metadata
.
get
(
'data_dir'
,
''
),
course_namespace
=
module
.
location
.
_replace
(
category
=
None
,
name
=
None
))
course_namespace
=
module
.
location
.
_replace
(
category
=
None
,
name
=
None
))
# Allow URLs of the form '/course/' refer to the root of multicourse directory
# Allow URLs of the form '/course/' refer to the root of multicourse directory
...
...
lms/envs/common.py
View file @
ab437b94
...
@@ -266,24 +266,6 @@ STATICFILES_DIRS = [
...
@@ -266,24 +266,6 @@ STATICFILES_DIRS = [
COMMON_ROOT
/
"static"
,
COMMON_ROOT
/
"static"
,
PROJECT_ROOT
/
"static"
,
PROJECT_ROOT
/
"static"
,
]
]
if
os
.
path
.
isdir
(
DATA_DIR
):
# Add the full course repo if there is no static directory
STATICFILES_DIRS
+=
[
# TODO (cpennington): When courses are stored in a database, this
# should no longer be added to STATICFILES
(
course_dir
,
DATA_DIR
/
course_dir
)
for
course_dir
in
os
.
listdir
(
DATA_DIR
)
if
(
os
.
path
.
isdir
(
DATA_DIR
/
course_dir
)
and
not
os
.
path
.
isdir
(
DATA_DIR
/
course_dir
/
'static'
))
]
# Otherwise, add only the static directory from the course dir
STATICFILES_DIRS
+=
[
# TODO (cpennington): When courses are stored in a database, this
# should no longer be added to STATICFILES
(
course_dir
,
DATA_DIR
/
course_dir
/
'static'
)
for
course_dir
in
os
.
listdir
(
DATA_DIR
)
if
(
os
.
path
.
isdir
(
DATA_DIR
/
course_dir
/
'static'
))
]
# Locale/Internationalization
# Locale/Internationalization
TIME_ZONE
=
'America/New_York'
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
TIME_ZONE
=
'America/New_York'
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
...
@@ -468,7 +450,7 @@ PIPELINE_JS = {
...
@@ -468,7 +450,7 @@ PIPELINE_JS = {
'source_filenames'
:
sorted
(
'source_filenames'
:
sorted
(
set
(
rooted_glob
(
COMMON_ROOT
/
'static'
,
'coffee/src/**/*.coffee'
)
+
set
(
rooted_glob
(
COMMON_ROOT
/
'static'
,
'coffee/src/**/*.coffee'
)
+
rooted_glob
(
PROJECT_ROOT
/
'static'
,
'coffee/src/**/*.coffee'
))
-
rooted_glob
(
PROJECT_ROOT
/
'static'
,
'coffee/src/**/*.coffee'
))
-
set
(
courseware_js
+
discussion_js
+
staff_grading_js
+
peer_grading_js
)
set
(
courseware_js
+
discussion_js
+
staff_grading_js
+
peer_grading_js
)
)
+
[
)
+
[
'js/form.ext.js'
,
'js/form.ext.js'
,
'js/my_courses_dropdown.js'
,
'js/my_courses_dropdown.js'
,
...
...
lms/envs/dev.py
View file @
ab437b94
...
@@ -106,6 +106,27 @@ VIRTUAL_UNIVERSITIES = []
...
@@ -106,6 +106,27 @@ VIRTUAL_UNIVERSITIES = []
COMMENTS_SERVICE_KEY
=
"PUT_YOUR_API_KEY_HERE"
COMMENTS_SERVICE_KEY
=
"PUT_YOUR_API_KEY_HERE"
############################## Course static files ##########################
if
os
.
path
.
isdir
(
DATA_DIR
):
# Add the full course repo if there is no static directory
STATICFILES_DIRS
+=
[
# TODO (cpennington): When courses are stored in a database, this
# should no longer be added to STATICFILES
(
course_dir
,
DATA_DIR
/
course_dir
)
for
course_dir
in
os
.
listdir
(
DATA_DIR
)
if
(
os
.
path
.
isdir
(
DATA_DIR
/
course_dir
)
and
not
os
.
path
.
isdir
(
DATA_DIR
/
course_dir
/
'static'
))
]
# Otherwise, add only the static directory from the course dir
STATICFILES_DIRS
+=
[
# TODO (cpennington): When courses are stored in a database, this
# should no longer be added to STATICFILES
(
course_dir
,
DATA_DIR
/
course_dir
/
'static'
)
for
course_dir
in
os
.
listdir
(
DATA_DIR
)
if
(
os
.
path
.
isdir
(
DATA_DIR
/
course_dir
/
'static'
))
]
################################# mitx revision string #####################
################################# mitx revision string #####################
MITX_VERSION_STRING
=
os
.
popen
(
'cd
%
s; git describe'
%
REPO_ROOT
)
.
read
()
.
strip
()
MITX_VERSION_STRING
=
os
.
popen
(
'cd
%
s; git describe'
%
REPO_ROOT
)
.
read
()
.
strip
()
...
...
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