-
Notifications
You must be signed in to change notification settings - Fork 1
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
propagate override #39
Conversation
@@ -692,6 +695,9 @@ def _save_xblock(user, xblock, data=None, children_strings=None, metadata=None, | |||
modulestore().publish(xblock.location, user.id) | |||
|
|||
# Note that children aren't being returned until we have a use case. | |||
|
|||
_propagate_library_updates(xblock.location.course_key,user.id) |
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.
nit: spacing
_propagate_library_updates(xblock.location.course_key,user.id) | |
_propagate_library_updates(xblock.location.course_key, user.id) |
@@ -89,6 +89,9 @@ | |||
NEVER = lambda x: False | |||
ALWAYS = lambda x: True | |||
|
|||
@pluggable_override("PROPAGATE_LIBRARY_UPDATES") | |||
def _propagate_library_updates(library_key_string, user_id): |
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.
An alternative to creating a separate function here is to override _save_xblock
, get its return value in the override function via the prev_fn
arg, and perform the required logic there prior to returning:
def override_save_xblock(_save_xblock, *args, **kwargs):
response = _save_xblock(*args, **kwargs)
# Your logic here
return response
This way we only need to include one line of changes in the edx repo, @pluggable_override("OVERRIDE_SAVE_XBLOCK")
. Although on the other hand, defining a custom function tamps down on the scope of what we're overriding / allows us to handle only the arguments we need. @tramck do you have an opinion?
@@ -89,6 +89,9 @@ | |||
NEVER = lambda x: False | |||
ALWAYS = lambda x: True | |||
|
|||
@pluggable_override("PROPAGATE_LIBRARY_UPDATES") |
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.
Pluggable override names should always be prefixed with OVERRIDE_
@pluggable_override("PROPAGATE_LIBRARY_UPDATES") | |
@pluggable_override("OVERRIDE_PROPAGATE_LIBRARY_UPDATES") |
Anytime we're making changes to the edx repo, we should include a
|
Co-authored-by: Travis McKinney <[email protected]>
Description
Describe what this pull request changes, and why. Include implications for people using this change.
Design decisions and their rationales should be documented in the repo (docstring / ADR), per
OEP-19, and can be
linked here.
Useful information to include:
"Developer", and "Operator".
changes.
Supporting information
Link to other information about the change, such as Jira issues, GitHub issues, or Discourse discussions.
Be sure to check they are publicly readable, or if not, repeat the information here.
Testing instructions
Please provide detailed step-by-step instructions for testing this change.
Deadline
"None" if there's no rush, or provide a specific date or event (and reason) if there is one.
Other information
Include anything else that will help reviewers and consumers understand the change.