-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-persisted studio templates #270
Conversation
I checked out the branch and did some interactive testing. Here are the results.
I did not test things outside of the unit page. |
I fixed the indent and '1'. Does anyone know what 'version: 1' in the old On Thu, Jun 27, 2013 at 1:45 PM, Christina Roberts <[email protected]
|
More interactive testing completed:
|
Fixed #5 (pending checkin) On Thu, Jun 27, 2013 at 3:24 PM, Christina Roberts <[email protected]
|
@@ -73,28 +74,38 @@ def save_item(request): | |||
|
|||
@login_required | |||
@expect_json | |||
def clone_item(request): | |||
def create_item(request): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create_item needs unit tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
@cpennington @cahrens @chrisndodge @jzoldak |
[MAXIMUM_ATTEMPTS, "", False], | ||
[PROBLEM_WEIGHT, "", False], | ||
# Not sure why this is True other than via inspection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this is related to your e-mail:
"I'm not sure where to record this, but the problem metadata is explicitly encoding 'rerandomization' and 'showanswer' when they come from defaults; so, the problem metadata editor thinks they've been explicitly set. I can't ferret out where the metadata is being set right now and it seems inconsequential and likely to be completely changed w/ the xblock/xmodule refactoring as well as using split mongo as the backing store."
Why do you think this is specifically related to problems and rerandomization/showanswer? It seems like this could be a general bug. Rerandomize is "always" at the course level (via Advanced Settings); showanswer is "closed" at the course level. We want users to be able to set defaults there, and with this bug, it seems impossible. (And another question-- it looks like you changed the LMS namespace defaults as well, but we still aren't see the new default values in Advanced Settings).
Further investigation needs to be done so that inheritance can work.
General note-- looks like pep8/pylint warnings are up. Also need to look through the diff coverage report and see what can be filled in. |
component_templates[category].append(( | ||
component_class.display_name.default or 'Blank', | ||
category, | ||
False, # No defaults have markdown (hardcoded current default) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this. Markdown is not a general thing among components.
@@ -31,6 +31,11 @@ def pretty_bool(value): | |||
|
|||
class WordCloudFields(object): | |||
"""XFields for word cloud.""" | |||
display_name = String( | |||
help="Display name for this module", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing the display name (display_name="Display Name"). It's showing up in the metadata editor with key display_name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
There is a bug with existing LaTeX problems. Repro steps:
dhm: this makes no sense as the template's only consulted by create_item. There's no way to revert to the template's content. I couldn't reproduce this. Update (christina): I can't reproduce it now either. Perhaps I edited the text on master directly in the XML Edtior vs the "LaTeX Source Compiler". Sorry for the false alarm. |
# add the default template | ||
component_templates[category].append(( | ||
component_class.display_name.default or 'Blank', | ||
category, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still wonder about this-- do we need to keep the "Blank"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we want it to say if the Descriptor doesn't define a default display_name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing? Will that blow up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will generate a menu item w/o a label.
So it turned out there was no bug in session_kv_store.py? It looks like the file is now gone from the PR. dhm: it was in the incidental-... PR which got merged yesterday |
if field in json_metadata: | ||
json_data['_inherited_metadata'][field] = json_metadata[field] | ||
|
||
new_block = system.xblock_from_json(cls, usage_id, json_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is super broken and shouldn't be merged. There are also no tests of this code. Boo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am also still concerned about iterating through inheritance.INHERITABLE_METADATA. I'm not sure if that is what your comment refers to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xblock_from_json
isn't defined anywhere. (Except in #271).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hijacked this methon in x_module b/c it wasn't being used anywhere and
made it serve the new persistence factory and other tests. When I
refactored the existing factory, I made a slightly incompatible api.
Perhaps I should reconcile them, but this change should be innocuous b/c no
code other than the split mongo code and factories calls this method.
On Thu, Jul 11, 2013 at 4:30 PM, Calen Pennington
[email protected]:
In common/lib/xmodule/xmodule/x_module.py:
json_data:
- 'category': the xmodule category (required)
- 'metadata': a dict of locally set metadata (not inherited)
- 'children': a list of children's usage_ids w/in this course
- 'definition':
- '_id' (optional): the usage_id of this. Will generate one if not given one.
"""
usage_id = json_data.get('_id', None)
if not '_inherited_metadata' in json_data and parent_xblock is not None:
json_data['_inherited_metadata'] = parent_xblock.xblock_kvs.get_inherited_metadata().copy()
json_metadata = json_data.get('metadata', {})
for field in inheritance.INHERITABLE_METADATA:
if field in json_metadata:
json_data['_inherited_metadata'][field] = json_metadata[field]
new_block = system.xblock_from_json(cls, usage_id, json_data)
xblock_from_json
isn't defined anywhere. (Except in #271https://github.com/edx/edx-platform/issues/271
).
… <#13fcf6dc92b48ffb_>
On Thu, Jul 11, 2013 at 3:56 PM, Christina Roberts <
[email protected] > wrote: In
common/lib/xmodule/xmodule/x_module.py: > + json_data: > + - 'category':
the xmodule category (required) > + - 'metadata': a dict of locally set
metadata (not inherited) > + - 'children': a list of children's usage_ids
w/in this course > + - 'definition': > + - '_id' (optional): the usage_id
of this. Will generate one if not given one. > + """ > + usage_id =
json_data.get('_id', None) > + if not '_inherited_metadata' in json_data
and parent_xblock is not None: > + json_data['inherited_metadata'] =
parent_xblock.xblock_kvs.get_inherited_metadata().copy() > + json_metadata
= json_data.get('metadata', {}) > + for field in inheritance.INHERITABLE
METADATA: > + if field in json_metadata: > +
json_data['_inherited_metadata'][field] = json_metadata[field] > + > +
new_block = system.xblock_from_json(cls, usage_id, json_data) I am also
still concerned about iterating through inheritance.INHERITABLE_METADATA.
I'm not sure if that is what your comment refers to. — Reply to this email
directly or view it on GitHub<
https://github.com/edx/edx-platform/pull/270/files#r5150865> .—
Reply to this email directly or view it on GitHubhttps://github.com/edx/edx-platform/pull/270/files#r5151788
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this change isn't needed before next-gen-modulestore
, let's just move it there, rather having unused broken code in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes, it was premature. I didn't realize it was in the wrong PR. I'll
look at whether to make it work w/ either persistence layer first.
On Tue, Jul 16, 2013 at 11:06 AM, Calen Pennington <[email protected]
wrote:
In common/lib/xmodule/xmodule/x_module.py:
json_data:
- 'category': the xmodule category (required)
- 'metadata': a dict of locally set metadata (not inherited)
- 'children': a list of children's usage_ids w/in this course
- 'definition':
- '_id' (optional): the usage_id of this. Will generate one if not given one.
"""
usage_id = json_data.get('_id', None)
if not '_inherited_metadata' in json_data and parent_xblock is not None:
json_data['_inherited_metadata'] = parent_xblock.xblock_kvs.get_inherited_metadata().copy()
json_metadata = json_data.get('metadata', {})
for field in inheritance.INHERITABLE_METADATA:
if field in json_metadata:
json_data['_inherited_metadata'][field] = json_metadata[field]
new_block = system.xblock_from_json(cls, usage_id, json_data)
If this change isn't needed before next-gen-modulestore, let's just move
it there, rather having unused broken code in this PR—
Reply to this email directly or view it on GitHubhttps://github.com/edx/edx-platform/pull/270/files#r5217901
.
The current state of this PR:
|
DraftModuleStore was originally designed as a mixin, but never used that way, and with the upcoming changes to use the versioned module store, never will be. This changes removes a circular dependency between mongo.py and draft.py.
This standardizes the XModule field default values to be the same as the values that are presented by studio when a component is added to a course.
Instead, we use XModule field default values when creating an empty XModule. Driven by this use case, we also allow for XModules to be created in memory without being persisted to the database at all. This necessitates a change to the Modulestore api, replacing clone_item with create_draft and save_xmodule.
The defaults used to be rerandomize=always, showanswer=closed. This is preserved for capa problems being imported from XML. However, for courses, and for problems created in Studio, the default has been changed to never/finished, to match the previous defaults used by Studio.
Add boilerplate option to ItemFactory Minor start date fix to not use microsecs
Full speed ahead! Damn the torpedoes! 👍 |
I'll sync up with Mark when he gets back re: updating those metadata fields in prod |
Non-persisted studio templates
Use JPGs instead of PNG for course images
…eries-metrics-am course metrics in time series
…-i18n Ginkgo: Update XBlock Utils to `1.1.1` for better i18n support in XBlock
Remove some edX-specific branding / links (like support URLs) in favor of values from configuration. Images (sample certificates) are still branded for now. We can get them later.
@dmitchell: Please validate commit contents, and then find reviewers.
Builds on #269 (net changes: edx/edx-platform@dhm/incidental-functionality-improvements...dhm/non-persisted-studio-templates)