• 
      

    Fix stale state issues in RelationCounterField when deleting models.

    Review Request #9231 — Created Sept. 28, 2017 and submitted

    Information

    Djblets
    release-0.10.x
    c631477...

    Reviewers

    RelationCounterField keeps track of each model instance that contain
    references to other models, in order to bump their counter fields, and
    it tries to notice when a new instance of a model has claimed the same
    ID as an old one (for use in test suites). However, it only worked when
    the old instances fell out of scope, and not when they were deleted
    (which resets the ID to None and prevents a later lookup from
    occurring).

    The field now tracks the pre_delete signal for the instance, taking
    care to reset state and untrack the instance. It also clears up signal
    handlers, ensuring we don't have any stale ones sitting around.

    Unit tests have been added for these fixes.

    Verified that the new unit tests failed before this fix, and pass
    after.

    Ran the Review Board test suite (with an upcoming change), which was
    failing. It now passes after this.

    Description From Last Updated

    F841 local variable 'model' is assigned to but never used

    reviewbotreviewbot

    F841 local variable 'model' is assigned to but never used

    reviewbotreviewbot
    Checks run (1 failed, 1 succeeded)
    flake8 failed.
    JSHint passed.

    flake8

    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-0.10.x (2741147)