Add support for the new dynamic CSS on the main site
authorMagnus Hagander <magnus@hagander.net>
Sat, 28 Dec 2013 16:39:05 +0000 (17:39 +0100)
committerMagnus Hagander <magnus@hagander.net>
Sat, 28 Dec 2013 16:39:05 +0000 (17:39 +0100)
We still need a fallback view to deal with local changes, but this
should make the common case faster - and open up for future changes
where we can add versioning to the file.

django/archives/mailarchives/views.py
django/archives/urls.py
django/media/css/archives.css

index 213dd894d07dbe79aba7b0d921bacb646c2d0e60..95895e736b62ead75010e1f8876fb600f6a88891 100644 (file)
@@ -531,6 +531,20 @@ def legacy(request, listname, year, month, msgnum):
 def mbox(request, listname, mboxname):
        return HttpResponse('This needs to be handled by the webserver. This view should never be called.', content_type='text/plain')
 
+@cache(hours=8)
+def base_css(request):
+       # Generate a hardcoded list of CSS imports. This will only be used
+       # in development installs - in production, it will use the CSS from
+       # the main website.
+       return HttpResponse("""@import url("/media/css/global.css");
+@import url("/media/css/layout.css");
+@import url("/media/css/text.css");
+@import url("/media/css/navigation.css");
+@import url("/media/css/table.css");
+
+@import url("/media/css/iefixes.css");
+""", mimetype='text/css')
+
 # Redirect to the requested url, with a slash first. This is used to remove
 # trailing slashes on messageid links by doing a permanent redirect. This is
 # better than just eating them, since this way we only end up with one copy
index 18809c8d667b186f8212eb146a7221eb76348e84..d524999dcca8a123b05c294c218d7d93977f4060 100644 (file)
@@ -44,6 +44,10 @@ urlpatterns = patterns('',
     # Legacy forwarding from old archives site
     (r'^message-id/legacy/([\w-]+)/(\d+)-(\d+)/msg(\d+).php$', 'archives.mailarchives.views.legacy'),
 
+    # Normally served off www.postgresql.org, but manually handled here for
+    # development installs.
+    (r'^dyncss/base.css', 'archives.mailarchives.views.base_css'),
+
     # Normally served by the webserver, but needed for development installs
     (r'^media/(.*)$', 'django.views.static.serve', {
                        'document_root': '../media',
index e25f9e04f82943dfa17780edcb262aee78073b4d..1c0504bee25bd252284f3fd88c4b86b03799c692 100644 (file)
@@ -1,12 +1,5 @@
 /* replacement for base.css used on archives */
-@import url("/media/css/global.css");
-@import url("/media/css/layout.css");
-@import url("/media/css/text.css");
-@import url("/media/css/navigation.css");
-@import url("/media/css/table.css");
-
-@import url("/media/css/iefixes.css");
-
+@import url("/dyncss/base.css");
 
 a                               { text-decoration: underline; }