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
e874de12
Commit
e874de12
authored
Apr 18, 2013
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some cleanup TODOs.
parent
57427f9a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
6 deletions
+26
-6
common/lib/xmodule/xmodule/capa_module.py
+2
-1
common/lib/xmodule/xmodule/mako_module.py
+23
-5
common/lib/xmodule/xmodule/xml_module.py
+1
-0
No files found.
common/lib/xmodule/xmodule/capa_module.py
View file @
e874de12
...
...
@@ -34,6 +34,7 @@ class StringyInteger(Integer):
return
None
# TODO: move to fields.py and remove duplicated code.
class
StringyFloat
(
Float
):
"""
A model type that converts from string to floats when reading from json
...
...
@@ -95,7 +96,7 @@ class CapaFields(object):
input_state
=
Object
(
help
=
"Dictionary for maintaining the state of inputtypes"
,
scope
=
Scope
.
user_state
)
student_answers
=
Object
(
help
=
"Dictionary with the current student responses"
,
scope
=
Scope
.
user_state
)
done
=
Boolean
(
help
=
"Whether the student has answered the problem"
,
scope
=
Scope
.
user_state
)
display_name
=
String
(
help
=
"Display name for this module"
,
scope
=
Scope
.
settings
)
display_name
=
XModule
.
display_name
seed
=
StringyInteger
(
help
=
"Random seed for this student"
,
scope
=
Scope
.
user_state
)
weight
=
StringyFloat
(
help
=
"How much to weight this problem by"
,
scope
=
Scope
.
settings
)
markdown
=
String
(
help
=
"Markdown source of this module"
,
scope
=
Scope
.
settings
)
...
...
common/lib/xmodule/xmodule/mako_module.py
View file @
e874de12
from
.x_module
import
XModuleDescriptor
,
DescriptorSystem
from
.modulestore.inheritance
import
own_metadata
from
xblock.core
import
Scope
class
MakoDescriptorSystem
(
DescriptorSystem
):
...
...
@@ -44,10 +46,26 @@ class MakoModuleDescriptor(XModuleDescriptor):
# cdodge: encapsulate a means to expose "editable" metadata fields (i.e. not internal system metadata)
@property
def
editable_metadata_fields
(
self
):
fields
=
{}
for
field
,
value
in
own_metadata
(
self
)
.
items
():
if
field
in
self
.
system_metadata_fields
:
# fields = {}
# for field, value in own_metadata(self).items():
# if field in self.system_metadata_fields:
# continue
#
# fields[field] = value
# return fields
inherited_metadata
=
getattr
(
self
,
'_inherited_metadata'
,
{})
metadata
=
{}
for
field
in
self
.
fields
:
# Only save metadata that wasn't inherited
if
field
.
scope
!=
Scope
.
settings
or
field
.
name
in
self
.
system_metadata_fields
:
continue
fields
[
field
]
=
value
return
fields
if
field
.
name
in
self
.
_model_data
:
metadata
[
field
.
name
]
=
self
.
_model_data
[
field
.
name
]
if
field
.
name
in
inherited_metadata
and
self
.
_model_data
.
get
(
field
.
name
)
==
inherited_metadata
.
get
(
field
.
name
):
metadata
[
field
.
name
]
=
str
(
metadata
[
field
.
name
])
+
' INHERITED'
else
:
metadata
[
field
.
name
]
=
str
(
getattr
(
self
,
field
.
name
))
+
' DEFAULT'
return
metadata
common/lib/xmodule/xmodule/xml_module.py
View file @
e874de12
...
...
@@ -155,6 +155,7 @@ class XmlDescriptor(XModuleDescriptor):
Remove any attribute named in cls.metadata_attributes from the supplied
xml_object
"""
# TODO: change to use Fields definitions
for
attr
in
cls
.
metadata_attributes
:
if
xml_object
.
get
(
attr
)
is
not
None
:
del
xml_object
.
attrib
[
attr
]
...
...
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