File: fix-static-root-dashboard-theme.patch

package info (click to toggle)
graphite-web 1.1.10-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,864 kB
  • sloc: javascript: 86,828; python: 12,228; sh: 91; makefile: 54
file content (23 lines) | stat: -rw-r--r-- 918 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
From: Alexandre Rossi <alexandre.rossi@gmail.com>
Subject: fix STATIC_ROOT not used for dashboard theme search (Fix #2683, #1702)
Forwarded: https://github.com/graphite-project/graphite-web/pull/2816

--- a/webapp/graphite/dashboard/views.py
+++ b/webapp/graphite/dashboard/views.py
@@ -1,4 +1,5 @@
 import re
+import os
 import errno

 from os.path import getmtime
@@ -126,6 +127,10 @@ def dashboard(request, name=None):
   debug = request.GET.get('debug', False)
   theme = request.GET.get('theme', config.ui_config['theme'])
   css_file = finders.find('css/dashboard-%s.css' % theme)
+  if css_file is None:
+    # Also search in STATIC_ROOT for dist packages
+    css_file = os.path.isfile(os.path.join(settings.STATIC_ROOT,
+                                           'css/dashboard-%s.css' % theme))
   if css_file is None:
     initialError = "Invalid theme '%s'" % theme
     theme = config.ui_config['theme']