Skip to content
This repository
Browse code

Removed static file finding utilities in theme inheritance, since thi…

…s doesn't work on prod.
  • Loading branch information...
commit c218f238bca222553c6b88b20158ad0f6788501b 1 parent 4c9189a
Nick Johnson authored November 25, 2008
1  main.py
@@ -39,7 +39,6 @@
39 39
 # Import custom django libraries
40 40
 webapp.template.register_template_library('utils.django_libs.gravatar')
41 41
 webapp.template.register_template_library('utils.django_libs.description')
42  
-webapp.template.register_template_library('utils.django_libs.find_static')
43 42
 
44 43
 # Log a message each time this module get loaded.
45 44
 logging.info('Loading %s, app version = %s',
41  utils/django_libs/find_static.py
... ...
@@ -1,41 +0,0 @@
1  
-# The MIT License
2  
-# 
3  
-# Copyright (c) 2008 Nick Johnson
4  
-# 
5  
-# Permission is hereby granted, free of charge, to any person obtaining a copy
6  
-# of this software and associated documentation files (the "Software"), to 
7  
-# deal in the Software without restriction, including without limitation 
8  
-# the rights to use, copy, modify, merge, publish, distribute, sublicense, 
9  
-# and/or sell copies of the Software, and to permit persons to whom the 
10  
-# Software is furnished to do so, subject to the following conditions:
11  
-# 
12  
-# The above copyright notice and this permission notice shall be included in
13  
-# all copies or substantial portions of the Software.
14  
-# 
15  
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18  
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
21  
-# DEALINGS IN THE SOFTWARE.
22  
-
23  
-"""
24  
-Utility function to get the path of a static file.
25  
-"""
26  
-__author__ = 'Nick Johnson'
27  
-
28  
-import logging
29  
-import os
30  
-import view
31  
-from google.appengine.ext import webapp
32  
-
33  
-register = webapp.template.create_template_register()
34  
-
35  
-def find_static_file(path):
36  
-  static_path = view.find_file(view.staticfiles, path)
37  
-  if static_path:
38  
-    return "/" + os.path.join("static", static_path)
39  
-  return ""
40  
-	
41  
-register.filter(find_static_file)
1  utils/template.py
@@ -101,7 +101,6 @@ class below because Django requires you to load the template with a method
101 101
     directory, file_name = os.path.split(abspath)
102 102
     if directory:
103 103
       template_dirs = [directory] + template_dirs
104  
-    logging.warn(template_dirs, file_name)
105 104
     new_settings = {
106 105
         'TEMPLATE_DIRS': template_dirs,
107 106
         'TEMPLATE_DEBUG': debug,
1  view.py
@@ -52,7 +52,6 @@ def build_tree(base):
52 52
         do_build_tree(basedir, theme, tree)
53 53
     return tree
54 54
 templates = build_tree('views')
55  
-staticfiles = build_tree('static')
56 55
 
57 56
 def find_file(tree, path):
58 57
     cur = tree
8  views/default/bloog/base.html
@@ -4,7 +4,7 @@
4 4
         <meta http-equiv="Content-Type" content="{{ blog.html_type }}; charset={{ blog.charset }}" />
5 5
         <title> {{ title }}</title>
6 6
         <meta name="generator" content="Bloog {{ bloog_version }}" />
7  
-        <link rel="stylesheet" href="{{"style.css"|find_static_file}}" type="text/css" media="screen" />
  7
+        <link rel="stylesheet" href="/static/default/style.css" type="text/css" media="screen" />
8 8
         <link rel="alternate" type="application/rss+xml" title="{{ blog.title }} RSS Feed" 
9 9
               href="{{ blog.root_url }}{{ blog.master_atom_url }}" />
10 10
         <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.2/build/assets/skins/sam/skin.css" />
@@ -18,7 +18,7 @@
18 18
             <div id="masthead" class="fix">
19 19
                 <h1><a href="/">{{ blog.title }}</a></h1>
20 20
                 <div id="authorBlurb">
21  
-                    <img src="{{"images/avatar.png"|find_static_file}}" alt="Avatar" />
  21
+                    <img src="/static/default/images/avatar.png" alt="Avatar" />
22 22
                     <p id="authorIntro">
23 23
                         {{ blog.description }}
24 24
                     </p>
@@ -89,7 +89,7 @@
89 89
                     <div id="searchWrap">
90 90
                         <form method="get" id="searchForm" action="/search">
91 91
                             <input type="text" value="{{ searchterm }}" name="s" id="s" />
92  
-                            <input id="searchsubmit" type="image" src="{{"images/btn_search.gif"|find_static_file}}" alt="Search" />
  92
+                            <input id="searchsubmit" type="image" src="/static/default/images/btn_search.gif" alt="Search" />
93 93
                         </form>
94 94
                     </div>
95 95
                     {% endblock %}
@@ -254,7 +254,7 @@
254 254
         </div>
255 255
 
256 256
         <script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/yahoo-dom-event/yahoo-dom-event.js"></script>
257  
-        <script type="text/javascript" src="{{"js/bloog_base.js"|find_static_file}}"></script>
  257
+        <script type="text/javascript" src="/static/default/js/bloog_base.js"></script>
258 258
 
259 259
         {% if user_is_admin %}
260 260
         {% include "form_editor.html" %}
6  views/default/bloog/blog/form_comment.html
@@ -37,8 +37,8 @@
37 37
 {% if not user_is_admin %}
38 38
 <!-- Load scripts if not already loaded due to admin interface -->
39 39
 <script type="text/javascript" src="http://yui.yahooapis.com/combo?2.5.2/build/yahoo-dom-event/yahoo-dom-event.js&2.5.2/build/animation/animation-min.js&2.5.2/build/connection/connection-min.js&2.5.2/build/container/container-min.js&2.5.2/build/menu/menu-min.js&2.5.2/build/element/element-beta-min.js&2.5.2/build/button/button-min.js&2.5.2/build/editor/editor-beta-min.js&2.5.2/build/selector/selector-beta-min.js"></script>
40  
-<script type="text/javascript" src="{{"js/ojay/js-class.js"|find_static_file}}"></script>
41  
-<script type="text/javascript" src="{{"js/ojay/core.js"|find_static_file}}"></script>
  40
+<script type="text/javascript" src="/static/default/js/ojay/js-class.js"></script>
  41
+<script type="text/javascript" src="/static/default/js/ojay/core.js"></script>
42 42
 {% endif %}
43  
-<script type="text/javascript" src="{{"js/bloog_comments.js"|find_static_file}}"></script>
  43
+<script type="text/javascript" src="/static/default/js/bloog_comments.js"></script>
44 44
 
2  views/default/bloog/contact/contact.get.html
@@ -21,7 +21,7 @@
21 21
             <p><input type="text" id="subject" name="subject" size="22" tabindex="3" />
22 22
                 <label for="subject"><small>Subject</small></label></p>
23 23
             <p><textarea id="message" name="message" cols="60" rows="10" tabindex="4">Please enter a message.</textarea></p>
24  
-            <p><input name="submit" type="image" src="{{"images/btn_submit.gif"|find_static_file}}" alt="Submit" id="submit" tabindex="5" value="Submit" /></p>
  24
+            <p><input name="submit" type="image" src="/static/default/images/btn_submit.gif" alt="Submit" id="submit" tabindex="5" value="Submit" /></p>
25 25
             <input type="hidden" name="token" value="{{ token }}" />
26 26
             <input type="hidden" name="curtime" value="{{ curtime|floatformat }}" />
27 27
         </form>
8  views/default/bloog/form_editor.html
... ...
@@ -1,7 +1,7 @@
1 1
 {% if user_is_admin %}
2 2
 
3 3
 {% block head %}
4  
-<link rel="stylesheet" type="text/css" href="{{"editor.css"|find_static_file}}" />
  4
+<link rel="stylesheet" type="text/css" href="/static/default/editor.css" />
5 5
 {% endblock %}
6 6
 
7 7
 <div id="postDialog" class="popupDialog">
@@ -27,9 +27,9 @@
27 27
 </div>
28 28
 
29 29
 <script type="text/javascript" src="http://yui.yahooapis.com/combo?2.5.2/build/yahoo-dom-event/yahoo-dom-event.js&2.5.2/build/animation/animation-min.js&2.5.2/build/connection/connection-min.js&2.5.2/build/container/container-min.js&2.5.2/build/menu/menu-min.js&2.5.2/build/element/element-beta-min.js&2.5.2/build/button/button-min.js&2.5.2/build/editor/editor-beta-min.js&2.5.2/build/selector/selector-beta-min.js"></script>
30  
-<script type="text/javascript" src="{{"js/ojay/js-class.js"|find_static_file}}"></script>
31  
-<script type="text/javascript" src="{{"js/ojay/core.js"|find_static_file}}""></script>
32  
-<script type="text/javascript" src="{{"js/bloog_admin.js"|find_static_file}}"></script>
  30
+<script type="text/javascript" src="/static/default/js/ojay/js-class.js"></script>
  31
+<script type="text/javascript" src="/static/default/js/ojay/core.js"></script>
  32
+<script type="text/javascript" src="/static/default/js/bloog_admin.js"></script>
33 33
 
34 34
 {% endif %}
35 35
 

0 notes on commit c218f23

Please sign in to comment.
Something went wrong with that request. Please try again.