Support including raw text fields in the API when using force-text-type.

Review Request #6436 — Created Oct. 14, 2014 and submitted

Information

Review Board
release-2.0.x
1ce708b...

Reviewers

The force-text-type= parameter in requests is useful for returning text
in a different format, but there are times when the client would need
the raw text along with this.

Now, the client can also send an include-raw-text-fields=1 parameter,
which will embed a raw_text_fields dictionary in the object's payload
containing an entry for each text field. Each entry provides the raw
version of the text. This is optional, in order to prevent the default
response from ballooning in size.

On an implementation level, this is done by removing all the custom
serializers, and instead adding some metadata to the resource's fields
list for each field that supports text types. MarkdownFieldsMixin's
serialize_object then handles embedding these raw fields in the payload
on request.

Tested manually wit and without the new parameter.

Unit tests pass.

Description From Last Updated

html isn't a valid option for POST/PUT.

daviddavid
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/base_comment.py
        reviewboard/webapi/resources/review_request_draft.py
        reviewboard/webapi/tests/mixins_comment.py
        reviewboard/webapi/resources/change.py
        reviewboard/webapi/resources/review_request.py
        reviewboard/webapi/tests/test_review_request_draft.py
        reviewboard/webapi/tests/mixins_review.py
        reviewboard/webapi/resources/base_review.py
        reviewboard/webapi/mixins.py
        reviewboard/webapi/resources/review_reply.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/base_comment.py
        reviewboard/webapi/resources/review_request_draft.py
        reviewboard/webapi/tests/mixins_comment.py
        reviewboard/webapi/resources/change.py
        reviewboard/webapi/resources/review_request.py
        reviewboard/webapi/tests/test_review_request_draft.py
        reviewboard/webapi/tests/mixins_review.py
        reviewboard/webapi/resources/base_review.py
        reviewboard/webapi/mixins.py
        reviewboard/webapi/resources/review_reply.py
    
    
  2. 
      
david
  1. 
      
  2. reviewboard/webapi/mixins.py (Diff revision 1)
     
     
     
     
    Show all issues

    html isn't a valid option for POST/PUT.

    1. This is just for type conversion for display. It doesn't actually post in these formats. That's what text_type= is for.

    2. Maybe clarify by saying "... or ``html`` to return the given text fields in the payload using the requested format"?

  3. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/base_comment.py
        reviewboard/webapi/resources/review_request_draft.py
        reviewboard/webapi/tests/mixins_comment.py
        reviewboard/webapi/resources/change.py
        reviewboard/webapi/resources/review_request.py
        reviewboard/webapi/tests/test_review_request_draft.py
        reviewboard/webapi/tests/mixins_review.py
        reviewboard/webapi/resources/base_review.py
        reviewboard/webapi/mixins.py
        reviewboard/webapi/resources/review_reply.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/base_comment.py
        reviewboard/webapi/resources/review_request_draft.py
        reviewboard/webapi/tests/mixins_comment.py
        reviewboard/webapi/resources/change.py
        reviewboard/webapi/resources/review_request.py
        reviewboard/webapi/tests/test_review_request_draft.py
        reviewboard/webapi/tests/mixins_review.py
        reviewboard/webapi/resources/base_review.py
        reviewboard/webapi/mixins.py
        reviewboard/webapi/resources/review_reply.py
    
    
  2. 
      
david
  1. Ship It!

  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (478363d)