appsembler / xblock-grade-fetcher

Grade Fetcher XBlock
MIT License
2 stars 1 forks source link

http_method POST will always fail #24

Open thraxil opened 2 years ago

thraxil commented 2 years ago

At the end of the grade_user() method, there's a check on whether grade >= 0: https://github.com/appsembler/xblock-grade-fetcher/blob/master/gradefetcher/gradefetcher.py#L492

That grade variable is only created on either line 416 or 418: https://github.com/appsembler/xblock-grade-fetcher/blob/master/gradefetcher/gradefetcher.py#L416 https://github.com/appsembler/xblock-grade-fetcher/blob/master/gradefetcher/gradefetcher.py#L418, both of which are inside the if self.http_method == "get": branch: https://github.com/appsembler/xblock-grade-fetcher/blob/master/gradefetcher/gradefetcher.py#L367

If http_method is instead post, and it skips that branch, running https://github.com/appsembler/xblock-grade-fetcher/blob/master/gradefetcher/gradefetcher.py#L473, grade never gets defined and the whole thing will always fail with a NameError exception.

thraxil commented 2 years ago

Actually, it errors out a line earlier on https://github.com/appsembler/xblock-grade-fetcher/blob/master/gradefetcher/gradefetcher.py#L490

amirtds commented 2 years ago

@thraxil We didn't implement the POST method functionality and users can't set the HTTP method to post in the studio author UI. I remove that code block for POST to prevent confusion.