More xblock.save() calls to handle fields set during inits - #505
Conversation
There was a problem hiding this comment.
IMO, does seem like overkill. Can you explain why you think you might need this?
There was a problem hiding this comment.
Only an abundance of caution. The problem is that init on some of our
descriptors set fields. I think I ensured that get_item will call .save()
but preview had an odd pattern which I vacillated on.
On Thu, Jul 25, 2013 at 9:57 PM, chrisndodge notifications@github.comwrote:
In cms/djangoapps/contentstore/views/preview.py:
@@ -43,6 +43,8 @@ def preview_dispatch(request, preview_id, location, dispatch=None):
"""descriptor = modulestore().get_item(location)
decache any pending field settings -- this one may be overkill
- descriptor.save()
IMO, does seem like overkill. Can you explain why you think you might need
this?—
Reply to this email directly or view it on GitHubhttps://github.com/edx/edx-platform/pull/505/files#r5414625
.
There was a problem hiding this comment.
I'm happy to remove that one. I put the comment there particularly to see
if anyone thought it was necessary to keep.
On Fri, Jul 26, 2013 at 8:51 AM, Don-edX Mitchell dmitchell@edx.org wrote:
Only an abundance of caution. The problem is that init on some of our
descriptors set fields. I think I ensured that get_item will call .save()
but preview had an odd pattern which I vacillated on.On Thu, Jul 25, 2013 at 9:57 PM, chrisndodge notifications@github.comwrote:
In cms/djangoapps/contentstore/views/preview.py:
@@ -43,6 +43,8 @@ def preview_dispatch(request, preview_id, location, dispatch=None):
"""descriptor = modulestore().get_item(location)
decache any pending field settings -- this one may be overkill
- descriptor.save()
IMO, does seem like overkill. Can you explain why you think you might
need this?—
Reply to this email directly or view it on GitHubhttps://github.com/edx/edx-platform/pull/505/files#r5414625
.
There was a problem hiding this comment.
Yeah, given that load_item has the call to .save(), I don't think we should add it here.
|
I can't VPN into jenkins, any ideas why the build is failing? |
|
@dianakhuang @sarina Here's the PR I put in for the missing save calls. |
|
Build failure was git or gcli. That is, never even made it to the build. |
There was a problem hiding this comment.
We should call .save on parent_xblock as well, since its children have been edited.
However, I think that xblock_from_json is probably the thing that should be responsible for calling .save() on the new_block
|
All comments verified and addressed, thank you all. Still no unit tests, but can I get approval to merge? |
|
Have you/could you verify that it fixes the issue w/ saw last week on edge? |
|
I never saw the problem on any env other than edge. Setting up for On Mon, Jul 29, 2013 at 9:23 AM, Calen Pennington
|
|
I can repro the issue on edge (it's still on master). Checking out this branch appears to fix the issue (I see Gregory Nagy's beautiful floating head once again). |
|
Sarina, You're my star. Thank you. Peter's writing a unit test (create video descriptor and then access field On Mon, Jul 29, 2013 at 10:10 AM, Sarina Canelake
|
There was a problem hiding this comment.
These edits (PEP8?) appear unrelated to the bug fix. I'm fine with it, but it seems extraneous.
There was a problem hiding this comment.
Well, it had some changes which I removed. I thought about taking it out but thought it didn't matter.
|
+1. Just one comment that a changed file appears to be unrelated to the bug fix. |
There was a problem hiding this comment.
Two things - what if parent_xblock is None? (this line will probably say, "Nonetype object has no attribute 'save'"
Second thing - until I'm done working on https://edx-wiki.atlassian.net/browse/LMS-769 , mutable types won't actually be persisted if you only call things like append. You'll need to do something like children.append(new_block); parent_xblock.children = children so that you actually hit a __set__ call, so that the save will actually persist the new list.
There was a problem hiding this comment.
That's what happens when I just listen to comments and don't think. Thank you.
|
Looks good to me. Pretty sure this will build properly but may be worth running tests locally before merging, since Jenkins is down at the moment and we want to be safe! |
|
I ran the tests. On Mon, Jul 29, 2013 at 12:27 PM, Sarina Canelake
|
More xblock.save() calls to handle fields set during inits
Feature/tomg/fall design
[YONK-146] Fix GP v1 notifications
…x-favicon-path Fix favicon display
…ponent-id-overflow Hide overflow of component ID in studio
PR openedx#505 mistakenly omitted the microfrontend services from the new `DEFAULT_SERVICES` list, which determines what is brought up upon `make dev.up`.
and other possible side effecting calls
@cpennington @chrisndodge Please review.
I need to think of tests which will fail w/o these changes and then prove they pass, but hopefully otherwise this is done.