]> git.openstreetmap.org Git - osqa.git/commitdiff
Fixing OSQA 258, Original templates can be directly accessed by public viewers.
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Fri, 21 May 2010 18:57:12 +0000 (18:57 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Fri, 21 May 2010 18:57:12 +0000 (18:57 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@313 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/urls.py
forum/views/meta.py

index 54624fba7661660d3a7f5418549dbf8fc0eb5ee8..588c50d55bb2745b19778552594be8cceeccaf3c 100644 (file)
@@ -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<path>.*)$', 'django.views.static.serve',
-        {'document_root': os.path.join(APP_PATH,'skins').replace('\\','/')},
-        name='osqa_media',
-    ),
+    url(r'^m/(?P<skin>\w+)/media/(?P<path>.*)$', app.meta.media , name='osqa_media'),
     url(r'^%s(?P<path>.*)$' % _('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'),
index 97c852f0a7e5d6194eb07367ab254391bb085f1b..bae96f2c7bf7b0fa5e3a88359d2bc27d32504522 100644 (file)
@@ -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)