Commit d94e4bcf authored by svilayphiou's avatar svilayphiou

merge

parent ead25e74
......@@ -13,9 +13,10 @@ urlpatterns = patterns(
'',
url(r'^admin/', include(admin.site.urls)),
url(r'^all/$', TemplateView.as_view(template_name = 'all.html'), name='all'),
url(r'^style.css$', 'relearn.views.css', name='css'),
url(r'^css/$', 'relearn.views.css', name='css'),
url(r'^publish/$', 'relearn.views.publish', name='publish'),
url(r'^print.css$', 'relearn.views.cssprint', name='css-print'),
url(r'^css-print/$', 'relearn.views.cssprint', name='css-print'),
url(r'^offset-print/$', 'relearn.views.offsetprint', name='offset-print'),
url(r'^$', 'relearn.views.home', name='home'),
url(r'^(?P<slug>[^/]+)\.xhtml$', 'relearn.views.xhtml', name='xhtml'),
url(r'^accounts/login$', 'django.contrib.auth.views.login',
......
......@@ -393,3 +393,16 @@ def cssprint(request):
css = f.read()
f.close()
return HttpResponse(css, mimetype="text/css")
def offsetprint(request):
try:
pad = Pad.objects.get(display_slug='offset.css')
padID = pad.group.groupID + '$' + urllib.quote_plus(pad.name.replace('::', '_'))
epclient = EtherpadLiteClient(pad.server.apikey, pad.server.apiurl)
return HttpResponse(epclient.getText(padID)['text'], mimetype="text/css")
except:
# If there is no pad called "css", loads a default css file
f = open('relearn/static/css/offset.css', 'r')
css = f.read()
f.close()
return HttpResponse(css, mimetype="text/css")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment