Skip to content
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

submission comment attachment and text #496

Open
vahtras opened this issue Jun 7, 2021 · 0 comments · May be fixed by #640
Open

submission comment attachment and text #496

vahtras opened this issue Jun 7, 2021 · 0 comments · May be fixed by #640

Comments

@vahtras
Copy link

vahtras commented Jun 7, 2021

Hi
As I was browsing through the code, I was looking for a way to comment on an assignment with text and an attachment in one step. I was able to do it in two steps with calls to edit() and upload_comment() separately. Have I missed something? If not would you consider a PR for something that appears to be a small fix? I would then be able to do something like this

submission.upload_comment('myfile.txt', text_comment='Here is my file')

to get

myfile

Regards,
Olav

cnuahs added a commit to cnuahs/canvasapi that referenced this issue Apr 23, 2024
Lots of weirdness around how uploading files to a submission works.
(see for example ucfopen#496 ucfopen#554 ucfopen#631).

This isn't really a fix for any of those. This is just a quick hack
to make it work for my use case. At present, a call to
Submission.upload_comment() to upload a file to attach to a comment,
includes an implicit call to Submission.edit() that creates an empty
comment (i.e, no text) on the submission, or, attached the file to any
previous comment.

This doesn't seem to fit with the description in the Canvas API
documentation and is never what you actually want. This change
removes that implicit call to .edit().

To comment on a submission and attache a file, first call
.upload_comment() to upload the file, and then call .edit() including
your comment text, grade etc. as well as the file id returned by
.upload_comment().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant