• 
      

    Fix more caching issues in WebAPIResource with etag generation.

    Review Request #7027 — Created March 9, 2015 and submitted

    Information

    Djblets
    release-0.8.x
    5145720...

    Reviewers

    WebAPIResource's newer etag generation code was incomplete. It assumed
    it could safely serialize any value looked up from the field. However,
    this failed to handle QuerySets, Managers, ForeignKeys, links, etc.
    
    We now call serialize_object and use this for the pre-encoded ETag
    value. To ensure we don't hit the database more than we need to, we now
    keep a cached copy of the results of serialize_object (using deepcopy,
    in order to prevent the cached copy from changing if the caller modifies
    the result). This ensures that the ETag is built from the payload that
    will be sent to the user (minus the aforementioned modifications, which
    are up to the caller to deal with as needed).

    All unit tests pass on Djblets and RB.

    ETags are no longer changing on subsequent requests.

    reviewbot
    1. Tool: PEP8 Style Checker
      Processed Files:
          djblets/webapi/resources.py
          djblets/webapi/tests.py
      
      
      
      Tool: Pyflakes
      Processed Files:
          djblets/webapi/resources.py
          djblets/webapi/tests.py
      
      
    2. 
        
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-0.8.x (b55e40e)