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
99c36929
Commit
99c36929
authored
Dec 13, 2014
by
Braden MacDonald
Committed by
E. Kolpakov
Jan 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validation should be on the descriptor, not the module
parent
eb4b1d57
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
42 deletions
+48
-42
common/lib/xmodule/xmodule/library_content_module.py
+48
-42
No files found.
common/lib/xmodule/xmodule/library_content_module.py
View file @
99c36929
...
...
@@ -264,49 +264,9 @@ class LibraryContentModule(LibraryContentFields, XModule, StudioEditableModule):
def
validate
(
self
):
"""
Validates the state of this Library Content Module Instance. This
is the override of the general XBlock method, and it will also ask
its superclass to validate.
Validates the state of this Library Content Module Instance.
"""
validation
=
super
(
LibraryContentModule
,
self
)
.
validate
()
if
not
isinstance
(
validation
,
StudioValidation
):
validation
=
StudioValidation
.
copy
(
validation
)
if
not
self
.
source_libraries
:
validation
.
set_summary
(
StudioValidationMessage
(
StudioValidationMessage
.
NOT_CONFIGURED
,
_
(
u"A library has not yet been selected."
),
action_class
=
'edit-button'
,
action_label
=
_
(
u"Select a Library"
)
)
)
return
validation
for
library_key
,
version
in
self
.
source_libraries
:
library
=
_get_library
(
self
.
runtime
.
descriptor_runtime
.
modulestore
,
library_key
)
if
library
is
not
None
:
latest_version
=
library
.
location
.
library_key
.
version_guid
if
version
is
None
or
version
!=
latest_version
:
validation
.
set_summary
(
StudioValidationMessage
(
StudioValidationMessage
.
WARNING
,
_
(
u'This component is out of date. The library has new content.'
),
action_class
=
'library-update-btn'
,
# TODO: change this to action_runtime_event='...' once the unit page supports that feature.
action_label
=
_
(
u"↻ Update now"
)
)
)
break
else
:
validation
.
set_summary
(
StudioValidationMessage
(
StudioValidationMessage
.
ERROR
,
_
(
u'Library is invalid, corrupt, or has been deleted.'
),
action_class
=
'edit-button'
,
action_label
=
_
(
u"Edit Library List"
)
)
)
break
return
validation
return
self
.
descriptor
.
validate
()
def
author_view
(
self
,
context
):
"""
...
...
@@ -444,6 +404,52 @@ class LibraryContentDescriptor(LibraryContentFields, MakoModuleDescriptor, XmlDe
self
.
system
.
modulestore
.
update_item
(
self
,
user_id
)
return
Response
()
def
validate
(
self
):
"""
Validates the state of this Library Content Module Instance. This
is the override of the general XBlock method, and it will also ask
its superclass to validate.
"""
validation
=
super
(
LibraryContentDescriptor
,
self
)
.
validate
()
if
not
isinstance
(
validation
,
StudioValidation
):
validation
=
StudioValidation
.
copy
(
validation
)
if
not
self
.
source_libraries
:
validation
.
set_summary
(
StudioValidationMessage
(
StudioValidationMessage
.
NOT_CONFIGURED
,
_
(
u"A library has not yet been selected."
),
action_class
=
'edit-button'
,
action_label
=
_
(
u"Select a Library"
)
)
)
return
validation
for
library_key
,
version
in
self
.
source_libraries
:
library
=
_get_library
(
self
.
runtime
.
modulestore
,
library_key
)
if
library
is
not
None
:
latest_version
=
library
.
location
.
library_key
.
version_guid
if
version
is
None
or
version
!=
latest_version
:
validation
.
set_summary
(
StudioValidationMessage
(
StudioValidationMessage
.
WARNING
,
_
(
u'This component is out of date. The library has new content.'
),
action_class
=
'library-update-btn'
,
# TODO: change this to action_runtime_event='...' once the unit page supports that feature.
action_label
=
_
(
u"↻ Update now"
)
)
)
break
else
:
validation
.
set_summary
(
StudioValidationMessage
(
StudioValidationMessage
.
ERROR
,
_
(
u'Library is invalid, corrupt, or has been deleted.'
),
action_class
=
'edit-button'
,
action_label
=
_
(
u"Edit Library List"
)
)
)
break
return
validation
def
editor_saved
(
self
,
user
,
old_metadata
,
old_content
):
"""
If source_libraries has been edited, refresh_children automatically.
...
...
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