Skip to content
This repository has been archived by the owner on Dec 31, 2021. It is now read-only.

Commit

Permalink
ENH: Allow only auth users to preview rest to html
Browse files Browse the repository at this point in the history
  • Loading branch information
ksurya committed Aug 28, 2015
1 parent 3cf097a commit e66d602
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions scipy_central/rest_comments/tests.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
from django.test import TestCase
from django.test.client import Client

from django.contrib.auth.models import User
from django.core.urlresolvers import reverse

class SimpleTest(TestCase):
def setUp(self):
self.client = Client()
self.user = User.objects.create_user(username='test', email='test@scipy.org',
password='notasecret')
self.client.post(reverse('auth_login'), {'username': self.user.username,
'password': 'notasecret'})

def test_basic(self):
""" Basic testing for the RST -> HTML conversion using Sphinx."""
Expand Down
3 changes: 2 additions & 1 deletion scipy_central/rest_comments/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import simplejson

# Django import
from django.contrib.auth.decorators import login_required
from django.contrib.sites.models import Site
from django.http import HttpResponse, Http404
from django.conf import settings
Expand Down Expand Up @@ -237,7 +238,7 @@ def call_sphinx_to_compile(working_dir):

return obj['body'].encode('utf-8')


@login_required
def rest_to_html_ajax(request):
"""
Convert reStructuredText to HTML for preview
Expand Down

0 comments on commit e66d602

Please sign in to comment.