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

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

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.
    Loading...