summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-04-18 17:36:00 +0100
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-04-18 17:36:00 +0100
commita58f373cec3b3bd4420478c99dde6e7fa2cba31b (patch)
tree83be97c15b6959d0eba7d1222b5114553040ef86
parent6b762c363224860833ea20c9ba8109c0c210d419 (diff)
downloadmorph-cache-server-a58f373cec3b3bd4420478c99dde6e7fa2cba31b.tar.gz
Fix various small issues preventing bundles from working.
-rwxr-xr-xmorph-cache-server7
-rw-r--r--morphcacheserver/repocache.py2
2 files changed, 6 insertions, 3 deletions
diff --git a/morph-cache-server b/morph-cache-server
index 5554481..57713e2 100755
--- a/morph-cache-server
+++ b/morph-cache-server
@@ -18,6 +18,7 @@
import cliapp
import logging
+import os
import urllib
from bottle import Bottle, request, response, run, static_file
@@ -48,7 +49,7 @@ class MorphCacheServer(cliapp.Application):
repo_cache = RepoCache(self,
self.settings['repo-dir'],
- self.settings['bundles'])
+ self.settings['bundle-dir'])
@app.get('/sha1s')
def sha1():
@@ -83,7 +84,9 @@ class MorphCacheServer(cliapp.Application):
def bundle():
repo = self._unescape_parameter(request.query.repo)
filename = repo_cache.get_bundle_filename(repo)
- return static_file(filename, download=True)
+ dirname = os.path.dirname(filename)
+ basename = os.path.basename(filename)
+ return static_file(basename, root=dirname, download=True)
root = Bottle()
root.mount(app, '/1.0')
diff --git a/morphcacheserver/repocache.py b/morphcacheserver/repocache.py
index e6ab640..3bb348f 100644
--- a/morphcacheserver/repocache.py
+++ b/morphcacheserver/repocache.py
@@ -83,7 +83,7 @@ class RepoCache(object):
def get_bundle_filename(self, repo_url):
quoted_url = self._quote_url(repo_url)
- return os.path.join(self.bundle_dir, '%s.bndl' % quoted_url)
+ return os.path.join(self.bundle_cache_dir, '%s.bndl' % quoted_url)
def _quote_url(self, url):
valid_chars = string.digits + string.letters + '%_'