Allow subclasses of RootResource to provide additional data.
Review Request #5287 — Created Jan. 21, 2014 and submitted
Allow subclasses of RootResource to provide additional data.
RootResource no longer hard-codes the structure of the resource data.
Subclasses can now overrideserialize_root()
to provide additional data.In order to allow caching to work correctly with custom data, we now use
arepr()
of the data instead of assuming certain contents when
generating the SHA1 for the ETag.
Used this in Review Board to add some new data. Verified the original and
additional data was included.Downloaded the resource and headers and saw the ETag. Ran with
curl -H 'If-None-Match: <etag>
and saw that it returned a Not Modified.Changed the payload and saw the ETag change.
Description | From | Last Updated |
---|---|---|
Can you explain this change and the testing you did for it? |
david |
- Description:
-
Allow subclasses of RootResource to provide additional data.
RootResource no longer hard-codes the structure of the resource data.
Subclasses can now override serialize_root()
to provide additional data.+ + In order to allow caching to work correctly with custom data, we now use
+ a repr()
of the data instead of assuming certain contents when+ generating the SHA1 for the ETag. - Testing Done:
-
Used this in Review Board to add some new data. Verified the original and
additional data was included. + + Downloaded the resource and headers and saw the ETag. Ran with
+ curl -H 'If-None-Match: <etag>
and saw that it returned a Not Modified.+ + Changed the payload and saw the ETag change.