bad URLs cause 500 errors where 404s would be expected

Bug #1174466 reported by Curtis Hovey
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
charmworld
Fix Released
Medium
Curtis Hovey

Bug Description

My URL hack to verify errors are logged app.log as well as emailed illustrates a weakness in the code:

2013-04-29 18:13:55,183 http://staging.jujucharms.com/api/0/charms/interesting/bing
Traceback (most recent call last):
  File "/home/webops_deploy/charmworld/local/lib/python2.7/site-packages/pyramid_exclog/__init__.py", line 44, in exclog_tween
    return handler(request)
  File "/home/webops_deploy/charmworld/local/lib/python2.7/site-packages/pyramid/router.py", line 161, in handle_request
    response = view_callable(context, request)
  File "/home/webops_deploy/charmworld/local/lib/python2.7/site-packages/pyramid/config/views.py", line 375, in viewresult_to_response
    result = view(context, request)
  File "/home/webops_deploy/charmworld/local/lib/python2.7/site-packages/pyramid/config/views.py", line 465, in _class_requestonly_view
    response = inst()
  File "/home/webops_deploy/charmworld/charmworld/views/api.py", line 91, in __call__
    result = self._handle(handler, args, kwargs)
  File "/home/webops_deploy/charmworld/charmworld/views/api.py", line 64, in _handle
    return handler(*args, **kwargs)
  File "/home/webops_deploy/charmworld/charmworld/views/api.py", line 292, in charms
    return self._handle(handler, args, kwargs)
UnboundLocalError: local variable 'handler' referenced before assignment

API0.charms() assumes it will always find a handler for the URL. I expect a 404 to be returned when I URL hack.

Tags: api oops

Related branches

Curtis Hovey (sinzui)
Changed in charmworld:
importance: High → Medium
Curtis Hovey (sinzui)
Changed in charmworld:
assignee: nobody → Curtis Hovey (sinzui)
status: Triaged → In Progress
Curtis Hovey (sinzui)
Changed in charmworld:
status: In Progress → Fix Committed
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.