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
39c61070
Commit
39c61070
authored
May 28, 2012
by
ichuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new feature - load course.xml + html + problems etc from git
(see courseware.views.quickedit_git_reload)
parent
5729d013
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
djangoapps/courseware/views.py
+37
-0
No files found.
djangoapps/courseware/views.py
View file @
39c61070
...
...
@@ -319,6 +319,9 @@ def quickedit(request, id=None, qetemplate='quickedit.html',coursename=None):
if
not
(
'dogfood_id'
in
request
.
session
and
request
.
session
[
'dogfood_id'
]
==
id
):
return
redirect
(
'/'
)
if
id
==
'course.xml'
:
return
quickedit_git_reload
(
request
)
# get coursename if stored
if
not
coursename
:
coursename
=
multicourse_settings
.
get_coursename_from_request
(
request
)
...
...
@@ -414,3 +417,37 @@ def quickedit(request, id=None, qetemplate='quickedit.html',coursename=None):
result
=
render_to_response
(
qetemplate
,
context
)
return
result
def
quickedit_git_reload
(
request
):
'''
reload course.xml and all courseware files for this course, from the git repo.
assumes the git repo has already been setup.
staff only.
'''
if
not
request
.
user
.
is_staff
:
return
redirect
(
'/'
)
# get coursename if stored
coursename
=
multicourse_settings
.
get_coursename_from_request
(
request
)
xp
=
multicourse_settings
.
get_course_xmlpath
(
coursename
)
# path to XML for the course
msg
=
""
if
'cancel'
in
request
.
POST
:
return
redirect
(
"/courseware"
)
if
'gitupdate'
in
request
.
POST
:
import
os
# FIXME - put at top?
cmd
=
"cd ../data
%
s; git pull origin
%
s"
%
(
xp
,
xp
.
replace
(
'/'
,
''
))
msg
+=
'<p>cmd:
%
s</p>'
%
cmd
ret
=
os
.
popen
(
cmd
)
.
read
()
msg
+=
'<p><pre>
%
s</pre></p>'
%
ret
.
replace
(
'<'
,
'<'
)
msg
+=
"<p>git update done!</p>"
context
=
{
'id'
:
id
,
'msg'
:
msg
,
'coursename'
:
coursename
,
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
}
result
=
render_to_response
(
"gitupdate.html"
,
context
)
return
result
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