Closed Bug 824968 Opened 12 years ago Closed 11 years ago

models undefined in apps/sumo/monkeypatch.py

Categories

(support.mozilla.org :: Code Quality, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
2013Q1

People

(Reporter: willkg, Assigned: rrosario)

Details

(Whiteboard: u=dev c=general p=0 s=2012.24)

I'm running the tests and (probably for other reasons) triggered the error exception in monkeypatch.py that's got a bug in it:

ERROR: kitsune.apps.forums.tests.test_notifications:NotificationsTests.test_admin_delete_user_with_watched_thread
  vim +344  apps/forums/tests/test_notifications.py  # test_admin_delete_user_with_watched_thread
    ModelAdmin(User, admin.site).delete_view(request, str(u.id))
  vim +25   vendor/src/django/django/utils/decorators.py  # _wrapper
    return bound_func(*args, **kwargs)
  vim +91   vendor/src/django/django/utils/decorators.py  # _wrapped_view
    response = view_func(request, *args, **kwargs)
  vim +21   vendor/src/django/django/utils/decorators.py  # bound_func
    return func(self, *args2, **kwargs2)
  vim +209  vendor/src/django/django/db/transaction.py  # inner
    return func(*args, **kwargs)
  vim +1274 vendor/src/django/django/contrib/admin/options.py  # delete_view
    [obj], opts, request.user, self.admin_site, using)
  vim +104  vendor/src/django/django/contrib/admin/util.py  # get_deleted_objects
    collector.collect(objs)
  vim +70   apps/sumo/monkeypatch.py  # _collect
    except models.ProtectedError, e:
NameError: global name 'models' is not defined


There are two problems there:

1. models isn't defined in that file, but should be (that's a one-line fix)
2. we should be using the new exception handling syntax:

      except models.ProtectedError as e:  # GOOD!

   instead of the old buggy one:

      except models.ProtectedError, e:  # BAD!
In a pull request.
Assignee: nobody → rrosario
Whiteboard: u=dev c=general p=0 s=2012.24
Target Milestone: --- → 2013Q1
This was deployed today.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.