Broken link to user page urls

Review Request #3836 — Created Feb. 3, 2013 and submitted

Review Board
2301, 2592, 2617
When Reviewboard is installed *not* at the root of a server, say, /reviewboard/ , the user links are broken. This happens in many places where User Links are obtained, for e.g. a) when searching, b) change description links when a user is changed in the Review Request.

The application tries to use Django's User.get_absolute_url(), which always returns /users/<username> ignoring the application path. This patch fixes this in 2 places
a) Adding a serialize_url_field to UserResource. This would fix all API calls
b) Adding a ABSOLUTE_URL_OVERRIDES section in for auth.user. (

We could have skipped (a) above by just adding ABSOLUTE_URL_OVERRIDES alone as djblets' serialize_url_field calls User.get_absolute_url and (b) would have solved it, but this doesnt take  localsites into consideration. Actually (b) above doesnt work with localsites, but then I found that localsites are not very well handled in other pages as well. For e.g. in the dashboard of a localsite, if you try to search for reviewrequests for a particular localsite, it doesnt show that because the url being searched is only /api/search, not s/localsite/api/search (If I run the search for s/localsite/api/search, it returns results correctly). I will file a separate bug for that , but once that is fixed, the solution (a) above is more correct because it takes localsite into consideration.

This patch should fix problems for all users who dont use localsites.
1. Ran all tests.
2. Created a site with a different SITE_ROOT, say, /reviewboard/ and made sure all user links show properly
3. Created a site with SITE_ROOT='/' and ensured user links show properly
4. Changed users in review requests with SITE_ROOT='/' and SITE_ROOT='/reviewboard/'
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
      Ignored Files:
  1. Ship It!
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-1.7.x (870a312)