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
0578175a
Commit
0578175a
authored
Jul 29, 2013
by
Don Mitchell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #505 from edx/dhm/xblock_save
More xblock.save() calls to handle fields set during inits
parents
d453f47b
393aa1da
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
7 deletions
+20
-7
common/lib/xmodule/xmodule/modulestore/mongo/base.py
+4
-0
common/lib/xmodule/xmodule/modulestore/split_mongo/caching_descriptor_system.py
+2
-0
common/lib/xmodule/xmodule/x_module.py
+11
-2
lms/djangoapps/courseware/module_render.py
+3
-5
No files found.
common/lib/xmodule/xmodule/modulestore/mongo/base.py
View file @
0578175a
...
...
@@ -225,6 +225,8 @@ class CachingDescriptorSystem(MakoDescriptorSystem):
non_draft_loc
=
location
.
replace
(
revision
=
None
)
metadata_to_inherit
=
self
.
cached_metadata
.
get
(
non_draft_loc
.
url
(),
{})
inherit_metadata
(
module
,
metadata_to_inherit
)
# decache any computed pending field settings
module
.
save
()
return
module
except
:
log
.
warning
(
"Failed to load descriptor"
,
exc_info
=
True
)
...
...
@@ -630,6 +632,8 @@ class MongoModuleStore(ModuleStoreBase):
definition_data
=
{}
dbmodel
=
self
.
_create_new_model_data
(
location
.
category
,
location
,
definition_data
,
metadata
)
xmodule
=
xblock_class
(
system
,
dbmodel
)
# decache any pending field settings from init
xmodule
.
save
()
return
xmodule
def
save_xmodule
(
self
,
xmodule
):
...
...
common/lib/xmodule/xmodule/modulestore/split_mongo/caching_descriptor_system.py
View file @
0578175a
...
...
@@ -116,4 +116,6 @@ class CachingDescriptorSystem(MakoDescriptorSystem):
module
.
previous_version
=
json_data
.
get
(
'previous_version'
)
module
.
update_version
=
json_data
.
get
(
'update_version'
)
module
.
definition_locator
=
self
.
modulestore
.
definition_locator
(
definition
)
# decache any pending field settings
module
.
save
()
return
module
common/lib/xmodule/xmodule/x_module.py
View file @
0578175a
...
...
@@ -537,11 +537,14 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock):
system: Module system
"""
return
self
.
module_class
(
# save any field changes
module
=
self
.
module_class
(
system
,
self
,
system
.
xblock_model_data
(
self
),
)
module
.
save
()
return
module
def
has_dynamic_children
(
self
):
"""
...
...
@@ -613,7 +616,13 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock):
new_block
=
system
.
xblock_from_json
(
cls
,
usage_id
,
json_data
)
if
parent_xblock
is
not
None
:
parent_xblock
.
children
.
append
(
new_block
)
children
=
parent_xblock
.
children
children
.
append
(
new_block
)
# trigger setter method by using top level field access
parent_xblock
.
children
=
children
# decache pending children field settings (Note, truly persisting at this point would break b/c
# persistence assumes children is a list of ids not actual xblocks)
parent_xblock
.
save
()
return
new_block
@classmethod
...
...
lms/djangoapps/courseware/module_render.py
View file @
0578175a
import
json
import
logging
import
re
import
sys
from
functools
import
partial
...
...
@@ -13,7 +12,6 @@ from django.http import Http404
from
django.http
import
HttpResponse
from
django.views.decorators.csrf
import
csrf_exempt
import
pyparsing
from
requests.auth
import
HTTPBasicAuth
from
statsd
import
statsd
...
...
@@ -599,14 +597,14 @@ def _check_files_limits(files):
# Check number of files submitted
if
len
(
inputfiles
)
>
settings
.
MAX_FILEUPLOADS_PER_INPUT
:
msg
=
'Submission aborted! Maximum
%
d files may be submitted at once'
%
\
msg
=
'Submission aborted! Maximum
%
d files may be submitted at once'
%
\
settings
.
MAX_FILEUPLOADS_PER_INPUT
return
msg
# Check file sizes
for
inputfile
in
inputfiles
:
if
inputfile
.
size
>
settings
.
STUDENT_FILEUPLOAD_MAX_SIZE
:
# Bytes
msg
=
'Submission aborted! Your file "
%
s" is too large (max size:
%
d MB)'
%
\
if
inputfile
.
size
>
settings
.
STUDENT_FILEUPLOAD_MAX_SIZE
:
# Bytes
msg
=
'Submission aborted! Your file "
%
s" is too large (max size:
%
d MB)'
%
\
(
inputfile
.
name
,
settings
.
STUDENT_FILEUPLOAD_MAX_SIZE
/
(
1000
**
2
))
return
msg
...
...
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