From: hernani Date: Fri, 21 May 2010 18:57:12 +0000 (+0000) Subject: Fixing OSQA 258, Original templates can be directly accessed by public viewers. X-Git-Tag: live~818 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/9746b4b78fc11e4f9785cef86333723c8307c003 Fixing OSQA 258, Original templates can be directly accessed by public viewers. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@313 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum/urls.py b/forum/urls.py index 54624fb..588c50d 100644 --- a/forum/urls.py +++ b/forum/urls.py @@ -35,19 +35,15 @@ for pattern_file in module_patterns: urlpatterns += patterns('', url(r'^$', app.readers.index, name='index'), url(r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}, name='sitemap'), - #(r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url': '/media/images/favicon.ico'}), - #(r'^favicon\.gif$', 'django.views.generic.simple.redirect_to', {'url': '/media/images/favicon.gif'}), + (r'^favicon\.ico$', app.meta.favicon), - url(r'^m/(?P.*)$', 'django.views.static.serve', - {'document_root': os.path.join(APP_PATH,'skins').replace('\\','/')}, - name='osqa_media', - ), + url(r'^m/(?P\w+)/media/(?P.*)$', app.meta.media , name='osqa_media'), url(r'^%s(?P.*)$' % _('upfiles/'), 'django.views.static.serve', {'document_root': os.path.join(APP_PATH,'upfiles').replace('\\','/')}, name='uploaded_file', ), - #url(r'^%s/$' % _('signin/'), 'django_authopenid.views.signin', name='signin'), + url(r'^%s$' % _('faq/'), app.meta.static, {'content': settings.FAQ_PAGE_TEXT, 'title': _('FAQ')}, name='faq'), url(r'^%s$' % _('about/'), app.meta.static, {'content': settings.ABOUT_PAGE_TEXT, 'title': _('About')}, name='about'), url(r'^%s$' % _('markdown_help/'), app.meta.markdown_help, name='markdown_help'), diff --git a/forum/views/meta.py b/forum/views/meta.py index 97c852f..bae96f2 100644 --- a/forum/views/meta.py +++ b/forum/views/meta.py @@ -1,8 +1,10 @@ +import os from itertools import groupby from django.shortcuts import render_to_response, get_object_or_404 from django.core.urlresolvers import reverse from django.template import RequestContext, loader from django.http import HttpResponseRedirect, HttpResponse +from django.views.static import serve from forum import settings from forum.forms import FeedbackForm from django.core.urlresolvers import reverse @@ -21,6 +23,10 @@ def favicon(request): def static(request, title, content): return render_to_response('static.html', {'content' : content, 'title': title}, context_instance=RequestContext(request)) +def media(request, skin, path): + return serve(request, "%s/media/%s" % (skin, path), + document_root=os.path.join(os.path.dirname(os.path.dirname(__file__)),'skins').replace('\\','/')) + def markdown_help(request): # md = markdown.Markdown([SettingsExtension({})]) # text = md.convert(settings.FAQ_PAGE_TEXT.value)