Add API for fetching and setting diff file attachments.

Review Request #4647 — Created Sept. 25, 2013 and discarded

Information

Review Board
master

Reviewers

Add API for fetching and setting diff file attachments.

There's now a /api/repositories/<id>/diff-file-attachments/ resource
that contains the known, registered diff file attachments tied to a
repository. Nothing on this tree can be modified, only retrieved.

In the future, some file attachments will be automatically associated.
Those that cannot can be modified by issuing a PUT on a draft filediff
resource and passing a file for the file attachment representing the
destination/modified file. Right now, this is allowed for all filediffs
for binary files, but later it will be restricted.

Unit tests pass.

Description From Last Updated

testing

VE venkuvenkius

'FileDiff' imported but unused

reviewbotreviewbot

Using .exists() will be faster and less code.

daviddavid

local variable 'attachment' is assigned to but never used

reviewbotreviewbot

'INVALID_FORM_DATA' imported but unused

reviewbotreviewbot

'scmtools' imported but unused

reviewbotreviewbot

'FileAttachment' imported but unused

reviewbotreviewbot

'DiffSet' imported but unused

reviewbotreviewbot

'FileDiff' imported but unused

reviewbotreviewbot

'FileDiff' imported but unused

reviewbotreviewbot

undefined name 'filediff'

reviewbotreviewbot
reviewbot
  1. This is a review from Review Bot.
    Tool: PEP8 Style Checker
    Processed Files:
    reviewboard/testing/testcase.py
    reviewboard/webapi/tests/urls.py
    reviewboard/webapi/resources/init.py
    reviewboard/attachments/forms.py
    reviewboard/attachments/managers.py
    reviewboard/webapi/resources/filediff.py
    reviewboard/webapi/tests/base.py
    reviewboard/webapi/tests/test_diff_file_attachment.py
    reviewboard/webapi/tests/test_draft_filediff.py
    reviewboard/webapi/resources/diff_file_attachment.py
    reviewboard/webapi/tests/mimetypes.py
    reviewboard/webapi/resources/draft_filediff.py
    reviewboard/webapi/resources/repository.py
    Ignored Files:
    docs/manual/webapi/2.0/resources/index.txt
    docs/manual/webapi/2.0/resources/diff-file-attachment.txt
    docs/manual/fixtures/initial_data.json
    docs/manual/webapi/2.0/resources/diff-file-attachment-list.txt

  2. 
      
reviewbot
  1. This is a review from Review Bot.
    Tool: Pyflakes
    Processed Files:
    reviewboard/testing/testcase.py
    reviewboard/webapi/tests/urls.py
    reviewboard/webapi/resources/init.py
    reviewboard/attachments/forms.py
    reviewboard/attachments/managers.py
    reviewboard/webapi/resources/filediff.py
    reviewboard/webapi/tests/base.py
    reviewboard/webapi/tests/test_diff_file_attachment.py
    reviewboard/webapi/tests/test_draft_filediff.py
    reviewboard/webapi/resources/diff_file_attachment.py
    reviewboard/webapi/tests/mimetypes.py
    reviewboard/webapi/resources/draft_filediff.py
    reviewboard/webapi/resources/repository.py
    Ignored Files:
    docs/manual/webapi/2.0/resources/index.txt
    docs/manual/webapi/2.0/resources/diff-file-attachment.txt
    docs/manual/fixtures/initial_data.json
    docs/manual/webapi/2.0/resources/diff-file-attachment-list.txt

  2. Show all issues

    'FileDiff' imported but unused

  3. Show all issues

    local variable 'attachment' is assigned to but never used

  4. Show all issues

    'INVALID_FORM_DATA' imported but unused

  5. Show all issues

    'scmtools' imported but unused

  6. Show all issues

    'FileAttachment' imported but unused

  7. Show all issues

    'DiffSet' imported but unused

  8. Show all issues

    'FileDiff' imported but unused

  9. Show all issues

    'FileDiff' imported but unused

  10. reviewboard/webapi/tests/urls.py (Diff revision 1)
     
     
    Show all issues

    undefined name 'filediff'

  11. 
      
david
  1. 
      
  2. reviewboard/webapi/resources/draft_filediff.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    Using .exists() will be faster and less code.

    1. get_for_filediff doesn't return a QuerySet. It's a get() call, so I can't take advantage of exists() without creating another method just for checking.

    2. OK.

  3. 
      
VE
  1. 
      
  2. reviewboard/attachments/managers.py (Diff revision 1)
     
     
    Show all issues

    testing

    1. This is a production server, and by doing your test here, you just spammed a bunch of people.

      If you want to test, you can use demo.reviewboard.org (username 'guest' password 'guest')

  3. 
      
chipx86
Review request changed
Status:
Discarded
Change Summary:
Replaced by /r/4860/