Add new 'absolute_url' field to Web API Resources

Review Request #4902 — Created Nov. 5, 2013 and submitted

Review Board
reviewboard, students

Add new 'absolute_url' field to Web API Resources

Add a new 'absolute_url' field to BaseFileAttachmentResource,
BaseScreenshotResource, ReviewGroupResource, and ReviewRequestResource.

Unit tests passed.

  • 0
  • 0
  • 2
  • 1
  • 3
Description From Last Updated
  1. One more thing to do, if you can. While we don't output docs for this yet, and it's a new convention, there's two new pieces of metadata for fields I'd like to see: added_in and deprecated_in.

    For the url fields being removed, there should be:

    'deprecated_in': '2.0',

    And for the absolute_url fields being added:

    'added_in': '2.0',
  2. This is going to cause problems, because the files are not always relative to the server. You need to ensure that they're not an absolute path first. For example, they may be on Amazon S3.

    1. HttpRequest.build_absolute_uri(location) specifies that "If the location is already an absolute URI, it will not be altered." So this should be fine.

  3. Best to use obj.get_absolute_url() here instead of calling the serialize function. Same with all other instances.

  4. Same comment as with the file attachments.

  1. Edward,

    This looks good, but the patch doesn't apply cleanly anymore. Can you update it?


  1. Ship It!
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (0995b36). Thanks!