aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/staticdirect.py
diff options
context:
space:
mode:
authorElrond <elrond+mediagoblin.org@samba-tng.org>2012-01-09 14:26:01 +0100
committerElrond <elrond+mediagoblin.org@samba-tng.org>2012-01-09 14:39:54 +0100
commit1b876ac2ea58830b187463dd3de75299fa257212 (patch)
treee7163c346e9e4f51a0f169a43787d7a1211b129d /mediagoblin/staticdirect.py
parent7cbbf3e75b2dc67068ec270e53249d95224a86cc (diff)
downloadmediagoblin-1b876ac2ea58830b187463dd3de75299fa257212.tar.lz
mediagoblin-1b876ac2ea58830b187463dd3de75299fa257212.tar.xz
mediagoblin-1b876ac2ea58830b187463dd3de75299fa257212.zip
Warn about unknown staticdirect paths.
Use pkg_resource to check for the existence of any files referenced by staticdirect. If they don't exist, warn about this. This might raise false warnings in the future for more advanced setups.
Diffstat (limited to 'mediagoblin/staticdirect.py')
-rw-r--r--mediagoblin/staticdirect.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/mediagoblin/staticdirect.py b/mediagoblin/staticdirect.py
index c6d2b374..2bddb160 100644
--- a/mediagoblin/staticdirect.py
+++ b/mediagoblin/staticdirect.py
@@ -14,9 +14,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import pkg_resources
-import urlparse
-
####################################
# Staticdirect infrastructure.
# Borrowed largely from cc.engine
@@ -26,7 +23,9 @@ import urlparse
####################################
import pkg_resources
-import urlparse
+import logging
+
+_log = logging.getLogger(__name__)
class StaticDirect(object):
@@ -37,6 +36,10 @@ class StaticDirect(object):
if filepath in self.cache:
return self.cache[filepath]
+ if not pkg_resources.resource_exists('mediagoblin',
+ 'static' + filepath):
+ _log.info("StaticDirect resource %r not found locally",
+ filepath)
static_direction = self.cache[filepath] = self.get(filepath)
return static_direction