equal
deleted
inserted
replaced
68 return HttpResponse(lxml.etree.tostring(doc, pretty_print=True), mimetype="text/xml;charset=utf-8") |
68 return HttpResponse(lxml.etree.tostring(doc, pretty_print=True), mimetype="text/xml;charset=utf-8") |
69 |
69 |
70 |
70 |
71 ## Creates an annotation from a urlencoded xml content |
71 ## Creates an annotation from a urlencoded xml content |
72 ## Returns an xml-structured annotation |
72 ## Returns an xml-structured annotation |
|
73 @oauth_required |
73 @csrf_exempt |
74 @csrf_exempt |
74 def create_annotation(request): |
75 def create_annotation(request): |
75 cont = request.POST["content"] |
76 cont = request.POST["content"] |
76 doc = lxml.etree.fromstring(cont) |
77 doc = lxml.etree.fromstring(cont) |
77 |
78 |
146 return HttpResponse(lxml.etree.tostring(doc, pretty_print=True), mimetype="text/xml;charset=utf-8") |
147 return HttpResponse(lxml.etree.tostring(doc, pretty_print=True), mimetype="text/xml;charset=utf-8") |
147 |
148 |
148 |
149 |
149 ## Deletes an annotation (from its id) |
150 ## Deletes an annotation (from its id) |
150 ## Returns an empty xml-structured annotation |
151 ## Returns an empty xml-structured annotation |
|
152 @oauth_required |
151 @csrf_exempt |
153 @csrf_exempt |
152 def delete_annotation(request): |
154 def delete_annotation(request): |
153 try: |
155 try: |
154 annot = Annotation.objects.get(external_id=request.POST["id"]) |
156 annot = Annotation.objects.get(external_id=request.POST["id"]) |
155 annot.delete() |
157 annot.delete() |
159 return HttpResponse("") |
161 return HttpResponse("") |
160 |
162 |
161 |
163 |
162 ## Updates the content of an annotation |
164 ## Updates the content of an annotation |
163 ## Returns the xml-structured updated annotation |
165 ## Returns the xml-structured updated annotation |
|
166 @oauth_required |
164 @csrf_exempt |
167 @csrf_exempt |
165 def update_annotation(request): |
168 def update_annotation(request): |
166 try: |
169 try: |
167 annot = Annotation.objects.get(external_id=request.POST["id"]) |
170 annot = Annotation.objects.get(external_id=request.POST["id"]) |
168 except Annotation.DoesNotExist: |
171 except Annotation.DoesNotExist: |