• 
      

    Improve support for fine-grained text types in the API.

    Review Request #6458 — Created Oct. 17, 2014 and submitted

    Information

    Review Board
    release-2.0.x
    db90d78...

    Reviewers

    This updates the various resources to support fine-grained setting of
    text types per-field, to list the text types, and to optionally return
    the raw values along with the forced values (if using force-text-type=
    and include-raw-text-fields=).

    Support for setting text_type= is still allowed on the resources that
    have split this field out. It will act as if individual *_text_type=
    values were passed. However, the returned text_type value in the payload
    is now hard-coded to null.

    New text.per_field_text_types and text.can_include_raw_values
    capabilities have been added.

    This is part of a set of changes to allow for per-field optional for
    Markdown. It requires the other set of changes.

    Unit tests pass.

    Tested all the new support through the UI, using upcoming changes.

    Description From Last Updated

    Col: 16 E127 continuation line over-indented for visual indent

    reviewbot reviewbot

    local variable 'old_rich_text' is assigned to but never used

    reviewbot reviewbot

    redefinition of unused 'test_post_with_text_type_markdown' from line 9

    reviewbot reviewbot

    redefinition of unused 'test_post_with_body_top_text_type_markdown' from line 27

    reviewbot reviewbot

    redefinition of unused 'test_post_with_body_bottom_text_type_markdown' from line 45

    reviewbot reviewbot

    redefinition of unused 'test_put_with_text_type_markdown' from line 162

    reviewbot reviewbot

    redefinition of unused 'test_put_with_body_top_text_type_markdown' from line 180

    reviewbot reviewbot

    redefinition of unused 'test_put_with_body_bottom_text_type_markdown' from line 198

    reviewbot reviewbot

    Shouldn't this be treated as an error?

    david david

    This loop is now pretty comical. Can you flatten it out?

    david david

    Would it make sense to raise NotImplementedError?

    david david

    Would it make sense to raise NotImplementedError?

    david david

    Same here.

    david david

    And here?

    david david

    And here?

    david david

    This should use "text type" instead of "text mode"

    david david

    This should use "text type" instead of "text mode"

    david david

    You could put the ( on the first line.

    david david

    Shouldn't this be passing in close_description_rich_text?

    david david

    I'm going to stop marking these, but if you decide on using NotImplementedError, can you do it throughout?

    david david
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          reviewboard/webapi/resources/base_comment.py
          reviewboard/webapi/tests/test_review.py
          reviewboard/webapi/server_info.py
          reviewboard/webapi/tests/test_review_reply.py
          reviewboard/webapi/resources/review_request_draft.py
          reviewboard/webapi/resources/review_request.py
          reviewboard/reviews/models/review_request.py
          reviewboard/webapi/tests/mixins_review.py
          reviewboard/webapi/resources/base_review.py
          reviewboard/webapi/mixins.py
          reviewboard/webapi/tests/test_review_request_draft.py
          reviewboard/webapi/resources/review_reply.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/webapi/resources/base_comment.py
          reviewboard/webapi/tests/test_review.py
          reviewboard/webapi/server_info.py
          reviewboard/webapi/tests/test_review_reply.py
          reviewboard/webapi/resources/review_request_draft.py
          reviewboard/webapi/resources/review_request.py
          reviewboard/reviews/models/review_request.py
          reviewboard/webapi/tests/mixins_review.py
          reviewboard/webapi/resources/base_review.py
          reviewboard/webapi/mixins.py
          reviewboard/webapi/tests/test_review_request_draft.py
          reviewboard/webapi/resources/review_reply.py
      
      
    2. reviewboard/webapi/mixins.py (Diff revision 1)
       
       
      Show all issues
      Col: 16
       E127 continuation line over-indented for visual indent
      
    3. Show all issues
       local variable 'old_rich_text' is assigned to but never used
      
    4. Show all issues
       redefinition of unused 'test_post_with_text_type_markdown' from line 9
      
    5. Show all issues
       redefinition of unused 'test_post_with_body_top_text_type_markdown' from line 27
      
    6. Show all issues
       redefinition of unused 'test_post_with_body_bottom_text_type_markdown' from line 45
      
    7. Show all issues
       redefinition of unused 'test_put_with_text_type_markdown' from line 162
      
    8. Show all issues
       redefinition of unused 'test_put_with_body_top_text_type_markdown' from line 180
      
    9. Show all issues
       redefinition of unused 'test_put_with_body_bottom_text_type_markdown' from line 198
      
    10. 
        
    chipx86
    chipx86
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          reviewboard/webapi/resources/base_comment.py
          reviewboard/webapi/tests/test_review.py
          reviewboard/webapi/server_info.py
          reviewboard/webapi/tests/test_review_reply.py
          reviewboard/webapi/resources/review_request_draft.py
          reviewboard/webapi/resources/review_request.py
          reviewboard/reviews/models/review_request.py
          reviewboard/webapi/tests/mixins_review.py
          reviewboard/webapi/resources/base_review.py
          reviewboard/webapi/mixins.py
          reviewboard/webapi/tests/test_review_request_draft.py
          reviewboard/webapi/resources/review_reply.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/webapi/resources/base_comment.py
          reviewboard/webapi/tests/test_review.py
          reviewboard/webapi/server_info.py
          reviewboard/webapi/tests/test_review_reply.py
          reviewboard/webapi/resources/review_request_draft.py
          reviewboard/webapi/resources/review_request.py
          reviewboard/reviews/models/review_request.py
          reviewboard/webapi/tests/mixins_review.py
          reviewboard/webapi/resources/base_review.py
          reviewboard/webapi/mixins.py
          reviewboard/webapi/tests/test_review_request_draft.py
          reviewboard/webapi/resources/review_reply.py
      
      
    2. 
        
    david
    1. 
        
    2. reviewboard/webapi/mixins.py (Diff revision 2)
       
       
       
      Show all issues

      Shouldn't this be treated as an error?

      1. Theoretically yes, but we don't have any way to bubble up an error from here.

    3. reviewboard/webapi/resources/base_review.py (Diff revision 2)
       
       
       
       
       
       
       
       
       
       
       
      Show all issues

      This loop is now pretty comical. Can you flatten it out?

      1. Yeah. I kept it in case we added new fields later, to keep the pattern the same with other resources. Not much point though.

    4. Show all issues

      Would it make sense to raise NotImplementedError?

      1. Sure.

      2. Oops, I remember why I return None.

        These actually do get serialized. We just override them. The values are useless, but something must be returned. If an error is raised, serialization fails.

        Switching back to None.

    5. Show all issues

      Would it make sense to raise NotImplementedError?

    6. Show all issues

      Same here.

    7. Show all issues

      And here?

    8. Show all issues

      And here?

    9. Show all issues

      This should use "text type" instead of "text mode"

    10. Show all issues

      This should use "text type" instead of "text mode"

    11. reviewboard/webapi/resources/review_request.py (Diff revision 2)
       
       
       
       
      Show all issues

      You could put the ( on the first line.

    12. Show all issues

      Shouldn't this be passing in close_description_rich_text?

    13. reviewboard/webapi/resources/review_request_draft.py (Diff revision 2)
       
       
       
       
       
       
       
       
      Show all issues

      I'm going to stop marking these, but if you decide on using NotImplementedError, can you do it throughout?

    14. 
        
    chipx86
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          reviewboard/webapi/resources/base_comment.py
          reviewboard/webapi/tests/test_review.py
          reviewboard/webapi/server_info.py
          reviewboard/webapi/tests/test_review_reply.py
          reviewboard/webapi/resources/review_request_draft.py
          reviewboard/webapi/resources/review_request.py
          reviewboard/reviews/models/review_request.py
          reviewboard/webapi/tests/mixins_review.py
          reviewboard/webapi/resources/base_review.py
          reviewboard/webapi/mixins.py
          reviewboard/webapi/tests/test_review_request_draft.py
          reviewboard/webapi/resources/review_reply.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/webapi/resources/base_comment.py
          reviewboard/webapi/tests/test_review.py
          reviewboard/webapi/server_info.py
          reviewboard/webapi/tests/test_review_reply.py
          reviewboard/webapi/resources/review_request_draft.py
          reviewboard/webapi/resources/review_request.py
          reviewboard/reviews/models/review_request.py
          reviewboard/webapi/tests/mixins_review.py
          reviewboard/webapi/resources/base_review.py
          reviewboard/webapi/mixins.py
          reviewboard/webapi/tests/test_review_request_draft.py
          reviewboard/webapi/resources/review_reply.py
      
      
    2. 
        
    david
    1. Ship It!

    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to markdown-redesign (b0d894f)