Repository navigation
Conversation
Submission.__init__ wraps attachments as File objects and Assignment.__init__ wraps overrides as AssignmentOverride objects, but their edit methods refresh the object through super().set_attributes(...), which bypasses that conversion and leaves plain dicts behind. Move the conversion into a set_attributes override in each class. CanvasObject.__init__ already calls self.set_attributes, so the same code now runs on creation and on refresh, and edit calls self.set_attributes instead of the base class method. Fixes ucfopen#721. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014EWzn81BUhtfWseuDtUBjx
dbosk
marked this pull request as ready for review
October 15, 2026 09:33
dbosk
requested review from
Thetwam,
bennettscience and
jonespm
as code owners
October 15, 2026 09:33
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
SubmissionandAssignmentconvert their nested objects (attachments→File,overrides→AssignmentOverride) in aset_attributesoverride instead of in__init__.Submission.editandAssignment.editrefresh the object withself.set_attributes(...)instead ofsuper(...).set_attributes(...), so the refresh goes through the same conversion.attachments/overridesleavesFile/AssignmentOverrideobjects (both fail ondevelop); an edit whose response omitsattachmentskeeps the existingFileobjects.Fixes #721.
Design
CanvasObject.__init__sets_requesterand then callsself.set_attributes(attributes), so a subclass override ofset_attributesalready runs when the object is created. Putting the conversion there means creation and every refresh share one code path, rather than duplicating the conversion in each method that refreshes. The refresh call sites had to change fromsuper(X, self).set_attributestoself.set_attributes, since the explicitsupercall is what bypassed the conversion.Behaviour is otherwise unchanged:
Submission.attachmentsis still[]when the payload has noattachments.Assignment.overridesis still only set when the payload hasoverrides.I surveyed the other classes that wrap nested objects in
__init__.GroupedSubmissionandSearchResulthave no method that refreshesself, so they are not affected and are left as they are.An alternative would be a declarative mapping on
CanvasObject(e.g._nested = {"attachments": File}) handled in the baseset_attributes. It is more general but touches every class. I kept to the per-class override, which is the smaller change, and am happy to do the general version if you prefer it.🤖 Generated with Claude Code
https://claude.ai/code/session_014EWzn81BUhtfWseuDtUBjx