vikrant
(VIKRANT)
February 19, 2021, 1:58pm
1
I am trying to understand how data gets reflected in database on modifying default ‘count’ field.
I reached the point where modified value is stored in cache and marked as dirty to store in database when xblock is saved.
But I’m unable to understand exactly at what point xblock.save() method is called?
Will be a great help if anyone can guide me on this.
braden
(Braden MacDonald (OpenCraft) - opencraft.com/help)
February 19, 2021, 10:31pm
2
Here, when you render
any view like student_view
: https://github.com/edx/XBlock/blob/1af0c970c20895276d75fc26501f60c98f434e3e/xblock/runtime.py#L828-L829
Rendering any view calls block.render()
which calls block.runtime.render()
which calls block.save()
, as you can see.
And here, when you call any handler: https://github.com/edx/XBlock/blob/1af0c970c20895276d75fc26501f60c98f434e3e/xblock/runtime.py#L1069-L1070
By the way, if you need to find something like this in the future, just edit the file where save() is and make it throw an exception. Then view your XBlock, get the exception, and see the traceback from the exception to see how the code was called.
1 Like
vikrant
(VIKRANT)
February 20, 2021, 5:18pm
3
@braden Thank you so much… You have been a great help always…