Giter VIP home page Giter VIP logo

canvas_course_info's People

Contributors

arthurian avatar bermudezjd avatar brainheart avatar chris-thornton-harvard avatar cmsnowden avatar cmurtaugh avatar condaatje avatar elliottyates avatar eparker71 avatar haydn9000 avatar rascalking avatar sapnamysore avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

canvas_course_info's Issues

Code Review

It would be nice if someone would take a look over this code (specifically at course_info/views.py) and make sure I'm not breaking every convention/standard/design protocol ever. Thanks Harry.

At its core, Views.py handles all the incoming requests and routes relevant data to the correct template.
The templates are course_info/editor.html and course_info/widget.html

Exception thrown when instructor list results contain records without a profile

The sort_and_format_instructor_display method assumes that instructor result records will contain a profile key that is either null or a list. However, the rest api returns None records instead of nulls, so using default values with a get doesn't fall back to the default. This results in a 'NoneType' object has no attribute 'get' exception that looks like this (from Splunk logs):

Server Error: /course_info/lti_launch Traceback (most recent call last): File "/var/opt/virtualenvs/canvas_course_info/local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 39, in inner response = get_response(request) File "/var/opt/virtualenvs/canvas_course_info/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response response = self._get_response(request) File "/var/opt/virtualenvs/canvas_course_info/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response response = self.process_exception_by_middleware(e, request) File "/var/opt/virtualenvs/canvas_course_info/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/var/opt/virtualenvs/canvas_course_info/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view return view_func(request, *args, **kwargs) File "/var/opt/virtualenvs/canvas_course_info/local/lib/python2.7/site-packages/django/views/decorators/http.py", line 40, in inner return func(request, *args, **kwargs) File "/var/opt/virtualenvs/canvas_course_info/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view return view_func(*args, **kwargs) File "/opt/tlt/canvas_course_info/course_info/views.py", line 82, in lti_launch return editor(request) File "/opt/tlt/canvas_course_info/course_info/views.py", line 196, in editor course_instance_id=course_instance_id) File "/opt/tlt/canvas_course_info/course_info/views.py", line 142, in _course_context instructor_display = sort_and_format_instructor_display(course_instructor_list) File "/opt/tlt/canvas_course_info/course_info/views.py", line 211, in sort_and_format_instructor_display course_instructor_list.sort(key=lambda x: (x.get('role', {}).get('role_id'), File "/opt/tlt/canvas_course_info/course_info/views.py", line 213, in <lambda> x.get('profile', {}).get('name_last'))) AttributeError: 'NoneType' object has no attribute 'get'

Further checks may be needed in the code to handle cases where instructors don't have profiles, including adding checks to the get_display_name method.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.