sphinx_django/sphinxcomment/views.py
author amit
Fri, 15 Oct 2010 15:59:28 +0530
changeset 2 f5e18f8ed036
parent 0 54f784230511
child 3 de4a2ed2f34b
permissions -rw-r--r--
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     1
# Create your views here.
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     2
from django.http import HttpResponse
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     3
from django.utils.simplejson import dumps 
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     4
from django.contrib.csrf.middleware import csrf_exempt
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     5
import django.forms as forms
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     6
from django.db import connection
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
     7
from django.http import HttpResponse,Http404
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     8
from sphinxcomment.models import Comment, Element
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     9
from django.shortcuts import get_object_or_404, render_to_response
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    10
from django.template import Context
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    11
from django.template.loader import get_template
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    12
from django.utils.simplejson import dumps 
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    13
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    14
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    15
placeholder_string = open('paragraph_id.py').read()
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    16
exec placeholder_string
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    17
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    18
def dump_queries():
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    19
    # requires settings.DEBUG to be set to True in order to work
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    20
    if len(connection.queries) == 1:
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    21
        print connection.queries
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    22
    else:
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    23
        qs = {}
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    24
        for q in connection.queries:
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    25
            qs[q['sql']] = qs.setdefault(q['sql'], 0) + 1
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    26
        for q in sorted(qs.items(), key=lambda x: x[1], reverse=True):
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    27
            print q
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    28
        print len(connection.queries)
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    29
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    30
class CommentForm(forms.Form):
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    31
    name = forms.CharField(max_length=64)
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    32
    url = forms.URLField(max_length=128, required=False)
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    33
    comment = forms.CharField(widget=forms.Textarea(attrs={
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    34
        'rows': 8, 'cols': 60
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    35
        }))
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    36
    remember = forms.BooleanField(initial=True, required=False)
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    37
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    38
def comments_by_chapter(chapter):
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    39
     objs = {}
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    40
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    41
     try:
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    42
         para_list=p_list[chapter]
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    43
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    44
         for paragraph_id in para_list:
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    45
           objs[paragraph_id]=[] 
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    46
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    47
     except:
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    48
         para_list=[]
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    49
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    50
     for paragraph_id in para_list:
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    51
         print chapter ,paragraph_id
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    52
         for c in Comment.objects.filter(element__chapter_name=chapter,element__paragraph_id=paragraph_id).order_by('date'):
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    53
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    54
             objs[paragraph_id].append(c)
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    55
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    56
             
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    57
     
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    58
     return objs
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    59
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    60
     
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    61
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    62
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    63
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    64
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    65
def chapter(request):
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    66
    template = get_template('comment.html')
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    67
    resp = {}
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    68
    for elt, comments in comments_by_chapter(chapter).iteritems():
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    69
        print elt ,comments
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    70
        form = CommentForm(initial={
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    71
            'paragraph_id': elt,
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    72
            'name': name
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    73
            })
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    74
        resp[elt] = template.render(Context({
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    75
            'paragraph_id': elt,
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    76
            'form': form,
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    77
            'length': len(comments),
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    78
            'query': comments,
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    79
            }))
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    80
    return HttpResponse(dumps(resp), mimetype='application/json')
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    81
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    82
def chapter_count(request,chapter_name):
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    83
    print chapter_name
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    84
    chapter_name=chapter_name.split('.')[0]
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    85
    comment_objs = comments_by_chapter(chapter_name)
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    86
    resp={}
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    87
    temp_dict={}
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    88
    for elt, comments in comment_objs.iteritems():
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    89
        temp_dict[elt]=len(comments)
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    90
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    91
    resp['count']=temp_dict
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    92
      
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    93
    
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    94
    print resp
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    95
    return HttpResponse(dumps(resp), mimetype='application/json')
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    96
    
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    97
def single(request,paragraph_id, form=None, newid=None):
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    98
    if paragraph_id[-1]=='/':
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    99
        paragraph_id=paragraph_id[:-1]
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   100
    queryset = Comment.objects.filter(element=paragraph_id)
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   101
    print paragraph_id 
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   102
    if form is None:
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   103
        form = CommentForm(initial={
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   104
            'paragraph_id': paragraph_id,
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   105
            'name': request.session.get('name', ''),
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   106
            })
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   107
    try:
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   108
        error = form.errors[0]
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   109
    except:
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   110
        error = ''
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   111
    print form.errors
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   112
    return render_to_response('comment.html', {
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   113
        'paragraph_id': paragraph_id,
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   114
        'form': form,
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   115
        'length': len(queryset),
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   116
        'query': queryset,
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   117
        'newid': newid or True,
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   118
        'error': error,
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   119
        })
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   120
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   121
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   122
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   123
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   124
def submit(request, paragraph_id):
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   125
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   126
    try:
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   127
        element = get_object_or_404(Element, paragraph_id=paragraph_id)
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   128
    except Http404:
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   129
        #creating chapter name from paragraph_id surely there is a better way using the context but i do not know as yet
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   130
        chapter_id='_'.join(paragraph_id.split('_')[0:-1])
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   131
        chapter_name=chapter_id[-1::-1].replace('_','/',1)[-1::-1]
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   132
        element=Element(chapter_name=chapter_name,paragraph_id=paragraph_id)
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   133
        element.save()
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   134
    print element.chapter_name
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   135
    form = None
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   136
    newid = None
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   137
    
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   138
    if request.method == 'POST':
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   139
        form = CommentForm(request.POST)
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   140
        print form.errors
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   141
        if form.is_valid():
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   142
            print form.cleaned_data
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   143
            data = form.cleaned_data
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   144
            if data.get('remember'):
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   145
                request.session['name'] = data['name']
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   146
                request.session['url'] = data['url']
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   147
            else:
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   148
                request.session.pop('name', None)
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   149
                request.session.pop('url', None)
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   150
            c = Comment(element=element,
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   151
                        comment=data['comment'],
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   152
                        submitter_name=data['name'],
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   153
                        submitter_url=data['url'],
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   154
                        ip=request.META.get('REMOTE_ADDR'))
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   155
            print c
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   156
            c.save()
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   157
           
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   158
            form = None
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   159
    return single(request, paragraph_id, form,)
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   160
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   161
def test(request):
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   162
    print request
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   163
    string="<p>test comment</p>"
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
   164
    return HttpResponse(string,mimetype="text/plain")
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   165
    
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   166
       
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   167
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   168
#return HttpResponse(dumps(string),mimetype="text/plain")
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   169
#test= csrf_exempt(test)
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
   170