def processPOST(request): graph = get_graph_from_request(request) payload = request.body insert_rdf(payload, content_type(request), graph) return HttpResponse(status = 204)
def advance_status(request): ''' Advance the status of an annotation ''' if isPOST(request) and 'application/json' in content_type(request): params = json.loads(request.body) LOGGING.info("advancing %s to state:%s" % (params.get('annotation'), params.get('toState'))) tmp_g = change_annotation_state(params.get('annotation'), params.get('toState')) return HttpResponse(tmp_g.serialize())
def advance_status(request): ''' Advance the status of an annotation ''' if isPOST(request) and 'application/json' in content_type(request): params = json.loads(request.body) if not params.has_key('annotation') or not params.has_key('state'): messages.add_message(request, messages.ERROR, "Missing annotation/state parameters") return mm_render_to_response_error(request, '400.html', 400) LOGGING.info("advancing %s to state:%s" % (params.get('annotation'), params.get('toState'))) tmp_g = change_annotation_state(params.get('annotation'), params.get('toState')) return HttpResponse(tmp_g.serialize())
def processPUT(request): graph = get_graph_from_request(request) payload = request.body g = None query_object = None if graph is None: g = ConjunctiveGraph(store=CharmeMiddleware.get_store()) query_object = ''' DROP SILENT DEFAULT; ''' query_object = '' else: g = ConjunctiveGraph(store=CharmeMiddleware.get_store()) query_object = ''' DROP SILENT GRAPH <%s>; ''' query_object = query_object % (graph) g.update(query_object) insert_rdf(payload, content_type(request), graph) return HttpResponse(status = 204)