File attachment - intermediate review

Review Request #1979 — Created Dec. 6, 2010 and submitted

Information

Review Board

Reviewers

Allows the attachment of downloadable files to a review request, using the new webapi.

Outstanding issues
- file comments do not update
- review request changed comments give a bad link when linking to removed files
Manual testing and running the existing test suite with no errors or failures.
LA
LA
LA
LA
Review request changed

Change Summary:

Added screenshots of the UI.
chipx86
  1. 
      
    1. Steven's going to be helping finish this up for the rest of his UCOSP term. Thanks for all the hard work Laila! I know this review is long-overdue.
      
      So for a first step, I'd get the patch merged, get the style stuff fixed up, and then we'll talk about the UI.
  2. reviewboard/filemanager/admin.py (Diff revision 2)
     
     
     
     
     
    Two blank lines between these.
    
    Trailing whitespace should be removed.
    
    Also, imports are alphabetical, so the filemanager one should go before the reviews ones.
  3. reviewboard/filemanager/admin.py (Diff revision 2)
     
     
     
    These should be combined, since one is overriding the other.
  4. reviewboard/filemanager/admin.py (Diff revision 2)
     
     
     
     
    Two blank lines between these.
  5. reviewboard/filemanager/forms.py (Diff revision 2)
     
     
    Same comment about the filemanager one. Should be alphabetical.
  6. reviewboard/filemanager/forms.py (Diff revision 2)
     
     
     
     
    Two blank lines between impors and classes.
  7. reviewboard/filemanager/forms.py (Diff revision 2)
     
     
     
    First line, immediately following the """, should be a one-line summary of the form, followed by a blank line, and then an optional description.
  8. reviewboard/filemanager/forms.py (Diff revision 2)
     
     
     
    Alignment issues.
    
    I don't think we want draft_caption set by default.
  9. reviewboard/filemanager/forms.py (Diff revision 2)
     
     
     
     
    Two blank lines.
  10. reviewboard/filemanager/forms.py (Diff revision 2)
     
     
     
     
    Same comment about docs.
  11. reviewboard/filemanager/forms.py (Diff revision 2)
     
     
     
    Should be spaces after :
    
    Also, this looks like it may be > 80 characters. If so, wrap widget= onto the next line.
  12. reviewboard/filemanager/forms.py (Diff revision 2)
     
     
     
     
    No blank line here.
  13. reviewboard/filemanager/forms.py (Diff revision 2)
     
     
     
    Alignment issues.
  14. reviewboard/filemanager/models.py (Diff revision 2)
     
     
     
     
    No blank line between these.
  15. reviewboard/filemanager/models.py (Diff revision 2)
     
     
     
     
    reviews.errors should go before reviews.signals.
  16. reviewboard/filemanager/models.py (Diff revision 2)
     
     
     
     
    Two blank lines.
  17. reviewboard/filemanager/models.py (Diff revision 2)
     
     
     
    Should be on the same line (summary).
  18. reviewboard/filemanager/models.py (Diff revision 2)
     
     
     
     
    Same line.
  19. reviewboard/filemanager/models.py (Diff revision 2)
     
     
    Should just be return self.upfile.url.
  20. reviewboard/filemanager/models.py (Diff revision 2)
     
     
     
     
    Same line.
  21. reviewboard/filemanager/models.py (Diff revision 2)
     
     
     
     
    This should probably be:
    
    return os.path.basename(self.upfile.name)
  22. reviewboard/filemanager/models.py (Diff revision 2)
     
     
    return self.caption
  23. reviewboard/filemanager/models.py (Diff revision 2)
     
     
     
     
     
     
     
     
    This should use the @permalink decorator. See other instances of get_absolute_url, specifically Screenshot's.
  24. reviewboard/filemanager/views.py (Diff revision 2)
     
     
    This view (and therefore the file) can go away, since the API should be used for this.
  25. reviewboard/htdocs/media/rb/css/reviews.css (Diff revision 2)
     
     
     
     
    Two blank lines.
  26. reviewboard/htdocs/media/rb/css/reviews.css (Diff revision 2)
     
     
     
     
    Two blank lines.
  27. reviewboard/htdocs/media/rb/js/datastore.js (Diff revision 2)
     
     
     
     
    Two blank lines.
  28. Wrong name. deleteFile.
  29. Wrong path. Shouldn't be screenshots.
  30. reviewboard/htdocs/media/rb/js/datastore.js (Diff revision 2)
     
     
     
     
     
     
    screenshot is wrong.
  31. reviewboard/htdocs/media/rb/js/datastore.js (Diff revision 2)
     
     
     
    Alignment problems.
  32. reviewboard/htdocs/media/rb/js/datastore.js (Diff revision 2)
     
     
     
     
    Two blank lines.
  33. on_ready.apply(this, arguments);
  34. on_done.apply(this, arguments);
  35. on_done.apply(this, arguments);
  36. on_done.apply(this, arguments);
  37. reviewboard/htdocs/media/rb/js/datastore.js (Diff revision 2)
     
     
     
     
    Two blank lines.
  38. on_ready.apply(this, arguments);
  39. reviewboard/htdocs/media/rb/js/datastore.js (Diff revision 2)
     
     
     
     
     
     
    Best as:
    
    if (this.text == "") {
        this.deleteComment();
    }
  40. on_done.apply(this, arguments);
  41. on_done.apply(this, arguments);
  42. on_done.apply(this, arguments);
  43. reviewboard/reviews/managers.py (Diff revision 2)
     
     
    Space after the ,
  44. reviewboard/reviews/models.py (Diff revision 2)
     
     
    Blank line before this.
  45. reviewboard/reviews/models.py (Diff revision 2)
     
     
    Blank line before this.
  46. reviewboard/reviews/models.py (Diff revision 2)
     
     
    UploadedFile should be on the next line, aligned with the other parameters.
  47. reviewboard/reviews/models.py (Diff revision 2)
     
     
     
     
    Same line.
  48. reviewboard/reviews/models.py (Diff revision 2)
     
     
     
    Alignment issues.
    
    I'd prefer "uploaded_file"
  49. reviewboard/reviews/templatetags/reviewtags.py (Diff revision 2)
     
     
     
     
    This can be better written as:
    
    if context_type in ('comment', 'screenshot_comment', 'file_comment'):
  50. reviewboard/reviews/urls.py (Diff revision 2)
     
     
     
     
     
     
    Won't be needed once the code is updated to use HTTP DELETE instead of this view.
  51. This will all need to be updated for the HTTP DELETE change. You can model it after how screenshots now do it.
  52. Trailing whitespace.
  53. This was copy/pasted from broken code. Look at what the above handler for screenshots now does.
  54. reviewboard/webapi/resources.py (Diff revision 2)
     
     
     
    forms before models.
  55. reviewboard/webapi/resources.py (Diff revision 2)
     
     
     
     
    Two blank lines.
  56. reviewboard/webapi/resources.py (Diff revision 2)
     
     
     
     
    More can fit on that first line.
  57. reviewboard/webapi/resources.py (Diff revision 2)
     
     
     
     
    Needs @webapi_check_local_site before the other decorators.
  58. reviewboard/webapi/resources.py (Diff revision 2)
     
     
     
    Needs NOT_LOGGED_IN in the list.
  59. reviewboard/webapi/resources.py (Diff revision 2)
     
     
    Should return _no_access_error(request.user)
  60. reviewboard/webapi/resources.py (Diff revision 2)
     
     
     
     
    Needs @webapi_check_local_site before other decorators.
    
    Also needs a @webapi_response_errors(DOES_NOT_EXIST, NOT_LOGGED_IN, PERMISSION_DENIED)
  61. reviewboard/webapi/resources.py (Diff revision 2)
     
     
    Should return _no_access_error(request.user)
  62. reviewboard/webapi/resources.py (Diff revision 2)
     
     
    @webapi_check_local_site
  63. reviewboard/webapi/resources.py (Diff revision 2)
     
     
    @webapi_check_local_site
  64. reviewboard/webapi/resources.py (Diff revision 2)
     
     
    @webapi_check_local_site
  65. reviewboard/webapi/resources.py (Diff revision 2)
     
     
     
     
     
    Blank lines should remain.
  66. reviewboard/webapi/resources.py (Diff revision 2)
     
     
     
     
     
    Blank lines should remain.
  67. reviewboard/webapi/resources.py (Diff revision 2)
     
     
     
     
    No blank lines.
  68. reviewboard/webapi/resources.py (Diff revision 2)
     
     
     
    @webapi_check_local_site
  69. reviewboard/webapi/resources.py (Diff revision 2)
     
     
     
    @webapi_check_local_site
  70. reviewboard/webapi/resources.py (Diff revision 2)
     
     
     
     
    Two blank lines.
  71. reviewboard/webapi/resources.py (Diff revision 2)
     
     
     
    @webapi_check_local_site and @webapi_response_errors.
  72. reviewboard/webapi/resources.py (Diff revision 2)
     
     
     
    Can fit on one line.
  73. reviewboard/webapi/resources.py (Diff revision 2)
     
     
    return _no_access_error(request.user)
  74. reviewboard/webapi/resources.py (Diff revision 2)
     
     
     
    Alignment issues.
  75. reviewboard/webapi/resources.py (Diff revision 2)
     
     
    @webapi_check_local_site
    
    There's a pattern here :) Going to stop saying it now. Can you go through and make sure all others have it too?
  76. reviewboard/webapi/resources.py (Diff revision 2)
     
     
    Should include NOT_LOGGED_IN.
    
    Same with every other @webapi_response_errors containing PERMISSION_DENIED.
  77. reviewboard/webapi/resources.py (Diff revision 2)
     
     
    _no_access_error
    
    Same with all others.
  78. reviewboard/webapi/resources.py (Diff revision 2)
     
     
     
     
    Two blank lines.
  79. 
      
LA
  1. Hi Christian,
    
    Sorry it took so long to reply-- it was crunch time for one of my classes. 
    I've pushed the changes you mentioned to my github.
    
    Thanks,
    Laila
  2. 
      
Loading...