← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~allenap/maas/static-url-with-forced-script-name into lp:maas

 

Gavin Panella has proposed merging lp:~allenap/maas/static-url-with-forced-script-name into lp:maas.

Commit message:
Add STATIC_URL_PATTERN, for use when FORCE_SCRIPT_PATH is not None.

Previously STATIC_URL was being used in places where FORCE_SCRIPT_PATH should be prefixed, *and* where it should not be prefixed. STATIC_URL_PATTERN is the variant that never contains the FORCE_SCRIPT_PATH prefix.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~allenap/maas/static-url-with-forced-script-name/+merge/129691

Pre-imp with rvba.
-- 
https://code.launchpad.net/~allenap/maas/static-url-with-forced-script-name/+merge/129691
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/maas/static-url-with-forced-script-name into lp:maas.
=== modified file 'src/maas/settings.py'
--- src/maas/settings.py	2012-09-19 13:48:42 +0000
+++ src/maas/settings.py	2012-10-15 15:25:26 +0000
@@ -174,7 +174,8 @@
 
 # URL prefix for static files.
 # Example: "http://media.lawrence.com/static/";
-STATIC_URL = '/static/'
+STATIC_URL_PATTERN = '/static/'
+STATIC_URL = STATIC_URL_PATTERN
 if FORCE_SCRIPT_NAME is not None:
     STATIC_URL = FORCE_SCRIPT_NAME + STATIC_URL
 

=== modified file 'src/maas/urls.py'
--- src/maas/urls.py	2012-06-20 14:41:56 +0000
+++ src/maas/urls.py	2012-10-15 15:25:26 +0000
@@ -32,7 +32,7 @@
             {'document_root': settings.MEDIA_ROOT}),
     )
 
-    urlpatterns += staticfiles_urlpatterns()
+    urlpatterns += staticfiles_urlpatterns(settings.STATIC_URL_PATTERN)
 
 if settings.DEBUG:
     from django.contrib import admin

=== modified file 'src/maasserver/middleware.py'
--- src/maasserver/middleware.py	2012-10-06 14:00:38 +0000
+++ src/maasserver/middleware.py	2012-10-15 15:25:26 +0000
@@ -78,7 +78,7 @@
             reverse('combo-maas'),
             reverse('combo-raphael'),
             # Static resources are publicly visible.
-            settings.STATIC_URL,
+            settings.STATIC_URL_PATTERN,
             reverse('robots'),
             reverse('api-doc'),
             # Metadata service is for use by nodes; no login.