• 
      

    Add a central function for returning the server URL.

    Review Request #6307 — Created Sept. 9, 2014 and submitted

    Information

    Review Board
    release-2.0.x
    bdc92c2...

    Reviewers

    We had a lot of code that attempted to build a server URL by fetching a
    Site, SiteConfiguration, doing a URL lookup, and building a string. This
    was getting silly, so I've added two central functions for this purpose:
    get_server_url() and build_server_url().

    get_server_url() returns the URL to the root of the server (or a Local
    Site, if one of the identifying arguments are provided).

    build_server_url() builds a URL off of the server URL. It's a
    convenience around calling urljoin(get_server_url(), ...).

    Many call sites have been updated to use these new functions. Many still
    remain, as we have templates that are building their own URLs, and some
    code that's doing fancier URL building, and I didn't want to risk
    breaking them right now.

    This also fixes a bug with the e-mail headers. We were always referring
    to the root of the site, rather than the Local Site, which made it harder
    to filter when working on multiple Local Sites.

    Unit tests pass.

    Tested each affected call site manually, with and without Local Sites.

    Description From Last Updated

    Col: 10 E111 indentation is not a multiple of four

    reviewbotreviewbot

    Col: 10 E113 unexpected indentation

    reviewbotreviewbot
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          reviewboard/notifications/tests.py
          reviewboard/webapi/server_info.py
          reviewboard/attachments/models.py
          reviewboard/admin/server.py
          reviewboard/hostingsvcs/googlecode.py
          reviewboard/admin/security_checks.py
          reviewboard/notifications/email.py
          reviewboard/hostingsvcs/github.py
          reviewboard/hostingsvcs/bitbucket.py
          reviewboard/hostingsvcs/hook_utils.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/notifications/tests.py
          reviewboard/webapi/server_info.py
          reviewboard/attachments/models.py
          reviewboard/admin/server.py
          reviewboard/hostingsvcs/googlecode.py
          reviewboard/admin/security_checks.py
          reviewboard/notifications/email.py
          reviewboard/hostingsvcs/github.py
          reviewboard/hostingsvcs/bitbucket.py
          reviewboard/hostingsvcs/hook_utils.py
      
      
    2. reviewboard/notifications/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 10
       E111 indentation is not a multiple of four
      
    3. reviewboard/notifications/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 10
       E113 unexpected indentation
      
    4. 
        
    chipx86
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          reviewboard/notifications/tests.py
          reviewboard/webapi/server_info.py
          reviewboard/attachments/models.py
          reviewboard/admin/server.py
          reviewboard/hostingsvcs/googlecode.py
          reviewboard/admin/security_checks.py
          reviewboard/notifications/email.py
          reviewboard/hostingsvcs/github.py
          reviewboard/hostingsvcs/bitbucket.py
          reviewboard/hostingsvcs/hook_utils.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/notifications/tests.py
          reviewboard/webapi/server_info.py
          reviewboard/attachments/models.py
          reviewboard/admin/server.py
          reviewboard/hostingsvcs/googlecode.py
          reviewboard/admin/security_checks.py
          reviewboard/notifications/email.py
          reviewboard/hostingsvcs/github.py
          reviewboard/hostingsvcs/bitbucket.py
          reviewboard/hostingsvcs/hook_utils.py
      
      
    2. 
        
    david
    1. Ship It!

    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-2.0.x (167cc95)