# HG changeset patch # User David Soria Parra # Date 1234968383 -3600 # Node ID 9be94f3dcaa0412a64708bcd4f899ea5b1f6bb28 # Parent bef09338ecebc59b0390c3f4ae7b574f38c15e4e downloads: fix import and paths diff -r bef09338eceb -r 9be94f3dcaa0 hgscm/apps/www/models.py --- a/hgscm/apps/www/models.py Wed Feb 18 15:32:57 2009 +0100 +++ b/hgscm/apps/www/models.py Wed Feb 18 15:46:23 2009 +0100 @@ -1,9 +1,11 @@ from django.db import models from django.utils import simplejson +from django.conf import settings +import os def get_download(platform, version): '''get the download for the right version''' - f = open('downloads.json') + f = open(os.path.join(settings.MEDIA_ROOT, "downloads.json")) list = simplejson.load(f) f.close() latest = version == 'latest' or not version @@ -14,7 +16,7 @@ return version['url'] def get_latest_version(): '''return the latest available version''' - f = open('downloads.json') + f = open(os.path.join(settings.MEDIA_ROOT, "downloads.json")) list = simplejson.load(f) f.close() for entry in list: diff -r bef09338eceb -r 9be94f3dcaa0 hgscm/apps/www/views.py --- a/hgscm/apps/www/views.py Wed Feb 18 15:32:57 2009 +0100 +++ b/hgscm/apps/www/views.py Wed Feb 18 15:46:23 2009 +0100 @@ -2,7 +2,9 @@ from django.template import RequestContext from django.http import HttpResponseRedirect from django.utils import simplejson -from apps.www.models import get_download, get_latest_version +from django.conf import settings +from hgscm.apps.www.models import get_download, get_latest_version +import os def frontpage(request): return render_to_response("frontpage.html", { 'latest_version': get_latest_version() }, @@ -16,7 +18,7 @@ def download(request, platform, version): return HttpResponseRedirect(get_download(platform, version)) def downloads(request): - f = open("downloads.json") + f = open(os.path.join(settings.MEDIA_ROOT, "downloads.json")) list = simplejson.load(f) f.close() return render_to_response("downloads.html", {'downloads': list},