Extensions' 'config/' and 'db/' admin links don't work when SITE_ROOT isn't '/'

Review Request #3874 — Created Feb. 16, 2013 and submitted

Information

Djblets

Reviewers

Fix admin-urls for extensions when SITE_ROOT != '/'

In the case of custom SITE_ROOTs, the calculation of the extensions' 'db/' and 'config/' seem to use the reverse function for extension_list method and then append it to the DynamicUrlResolvers' add_patterns method. This adds an additional SITE_ROOT pattern as reverse(extension_list) itself returns the path with the SITE_ROOT. So, instead of the url for SITE_ROOT='/reviews/' being

reviews/admin/extensions/rbcustomreports.extension.CustomReportsExtension/config/
it turns out to be
reviews/reviews/admin/extensions/rbcustomreports.extension.CustomReportsExtension/config/

Fixed this by lstrip-ing the SITE_ROOT after getting a reverse function so that dynamic url resolver adds it properly. This should work for SITE_ROOT='/' or custom SITE_ROOTs.
Tested with SITE_ROOT='/' and SITE_ROOT='/reviews/', installed an extension and testing the "Configure" link.
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        djblets/extensions/base.py
      Ignored Files:
    
    
  2. 
      
SM
  1. Looks good to me.
  2. 
      
chipx86
  1. Ship It!
  2. 
      
RA
Review request changed
Status:
Completed
Change Summary:
Pushed to master (8515309)