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
fa5537ab
Commit
fa5537ab
authored
Feb 07, 2013
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
On first request for handouts, create the db record. (bug 160)
parent
48e58264
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
8 deletions
+4
-8
cms/djangoapps/contentstore/module_info_model.py
+4
-8
No files found.
cms/djangoapps/contentstore/module_info_model.py
View file @
fa5537ab
import
logging
from
static_replace
import
replace_static_urls
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.django
import
modulestore
from
lxml
import
etree
import
re
from
django.http
import
HttpResponseBadRequest
,
Http404
from
django.http
import
Http404
def
get_module_info
(
store
,
location
,
parent_location
=
None
,
rewrite_static_links
=
False
):
...
...
@@ -15,7 +11,9 @@ def get_module_info(store, location, parent_location=None, rewrite_static_links=
else
:
module
=
store
.
get_item
(
location
)
except
ItemNotFoundError
:
raise
Http404
# create a new one
template_location
=
Location
([
'i4x'
,
'edx'
,
'templates'
,
location
.
category
,
'Empty'
])
module
=
store
.
clone_item
(
template_location
,
location
)
data
=
module
.
definition
[
'data'
]
if
rewrite_static_links
:
...
...
@@ -40,7 +38,6 @@ def get_module_info(store, location, parent_location=None, rewrite_static_links=
def
set_module_info
(
store
,
location
,
post_data
):
module
=
None
isNew
=
False
try
:
if
location
.
revision
is
None
:
module
=
store
.
get_item
(
location
)
...
...
@@ -54,7 +51,6 @@ def set_module_info(store, location, post_data):
# presume that we have an 'Empty' template
template_location
=
Location
([
'i4x'
,
'edx'
,
'templates'
,
location
.
category
,
'Empty'
])
module
=
store
.
clone_item
(
template_location
,
location
)
isNew
=
True
if
post_data
.
get
(
'data'
)
is
not
None
:
data
=
post_data
[
'data'
]
...
...
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