diff options
author | Aaron Williamson <aaron@copiesofcopies.org> | 2012-01-17 00:59:21 -0500 |
---|---|---|
committer | Aaron Williamson <aaron@copiesofcopies.org> | 2012-01-17 00:59:21 -0500 |
commit | 99a270e95298b248a77b07203ab3921078bd7906 (patch) | |
tree | 34711abf27ab7a614c92842b456bf74ec3d5d5fb /mediagoblin/staticdirect.py | |
parent | 25b48323a86a1036112f2f33c889d5d12d5dee9c (diff) | |
parent | 8c7701f9f1653cf4038143cfb7a497ae21edf108 (diff) | |
download | mediagoblin-99a270e95298b248a77b07203ab3921078bd7906.tar.lz mediagoblin-99a270e95298b248a77b07203ab3921078bd7906.tar.xz mediagoblin-99a270e95298b248a77b07203ab3921078bd7906.zip |
Merged changes with upstream
Diffstat (limited to 'mediagoblin/staticdirect.py')
-rw-r--r-- | mediagoblin/staticdirect.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/mediagoblin/staticdirect.py b/mediagoblin/staticdirect.py index 58175881..2bddb160 100644 --- a/mediagoblin/staticdirect.py +++ b/mediagoblin/staticdirect.py @@ -14,31 +14,34 @@ # 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 # by Chris Webber & Creative Commons -# +# # This needs documentation! #################################### import pkg_resources -import urlparse +import logging + +_log = logging.getLogger(__name__) + class StaticDirect(object): def __init__(self): self.cache = {} def __call__(self, filepath): - if self.cache.has_key(filepath): + 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 - def get(self, filepath): # should be implemented by the individual staticdirector |