Open mickmuzac opened 10 years ago
I was trying to do the exact same thing you were. It doesn't appear as if custom Scopes are supported (or I just can't figure out how to implement them).
There is an LmsFieldData
class in edx-platform/lms/djangoapps/lms_xblock/field_data.py
that inherits from SplitFieldData
(Xblock field_data.py
). In the the LmsFieldData
constructor, it lists the 'allowable' scopes. eg:
super(LmsFieldData, self).__init__({
Scope.content: authored_data,
Scope.settings: authored_data,
Scope.parent: authored_data,
Scope.children: authored_data,
Scope.user_state_summary: student_data,
Scope.user_state: student_data,
Scope.user_info: student_data,
Scope.preferences: student_data,
})
I can't find a way to register a new one.
Does anyone know if custom scopes are supported in any way? The documentation isn't clear, but seems to suggest it's possible by explaining all the different combinations and pointing our 'here are some predefined ones'.
Thanks!
This is the code I'm currently using to try to do this:
Whenever I attempt to read the value of the Field, an
InvalidScopeError
is raised. This doesn't seem to happen with the other predefined Scopes (e.gScope.content
). Furthermore, the error only seems to happen if I attempt to access the value of the Field from within the student_view.Here is a stack trace: