diff options
author | Christoph Helma <helma@in-silico.ch> | 2012-08-17 16:46:39 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2012-08-17 16:46:39 +0200 |
commit | f844ca5a9f18b8ca10275b3cc3a46053373cabbd (patch) | |
tree | 4719488bf90c735969064531faef0c19c1899d45 | |
parent | 39197c9e11837613bd83d5dd77fc9aaf1e454787 (diff) |
intermediate fix for 4store RestClient errors
-rw-r--r-- | lib/4store.rb | 16 | ||||
-rw-r--r-- | lib/opentox.rb | 5 |
2 files changed, 12 insertions, 9 deletions
diff --git a/lib/4store.rb b/lib/4store.rb index f6879b0..8715ea7 100644 --- a/lib/4store.rb +++ b/lib/4store.rb @@ -29,11 +29,11 @@ module OpenTox bad_request_error "'#{mime_type}' is not a supported content type. Please use one of #{@@content_type_formats.join(", ")}." unless @@content_type_formats.include? mime_type or mime_type == "multipart/form-data" bad_request_error "Reqest body empty." unless rdf mime_type = "application/x-turtle" if mime_type == "text/plain" # ntriples is turtle in 4store - #begin + begin RestClient.post File.join(four_store_uri,"data")+"/", :data => rdf, :graph => uri, "mime-type" => mime_type - #rescue - #rest_call_error $!.message, File.join(four_store_uri,"data")+"/" - #end + rescue + bad_request_error $!.message, File.join(four_store_uri,"data")+"/" + end end def self.put uri, rdf, mime_type @@ -41,9 +41,9 @@ module OpenTox bad_request_error "Reqest body empty." unless rdf mime_type = "application/x-turtle" if mime_type == "text/plain" #begin - RestClient.put File.join(four_store_uri,"data",uri), rdf, :content_type => mime_type + RestClientWrapper.put File.join(four_store_uri,"data",uri), rdf, :content_type => mime_type #rescue - #rest_call_error $!.message, File.join(four_store_uri,"data",uri) + #bad_request_error $!.message, File.join(four_store_uri,"data",uri) #end end @@ -91,8 +91,8 @@ module OpenTox # TODO: check if this prevents SPARQL injections bad_request_error "Only SELECT and CONSTRUCT are accepted SPARQL statements." end - #rescue - #rest_call_error $!.message, sparql_uri + rescue + bad_request_error $!.message, sparql_uri end def self.klass diff --git a/lib/opentox.rb b/lib/opentox.rb index 3d1092a..1e7b791 100644 --- a/lib/opentox.rb +++ b/lib/opentox.rb @@ -1,6 +1,6 @@ require 'sinatra/base' +require "sinatra/reloader" ENV["RACK_ENV"] ||= "production" -require "sinatra/reloader" if ENV["RACK_ENV"] == "development" require File.join(ENV["HOME"],".opentox","config","#{SERVICE}.rb") @@ -20,6 +20,9 @@ module OpenTox configure :development do register Sinatra::Reloader + also_reload "./*.rb" + also_reload "../opentox-client/lib/*.rb" + also_reload File.join(ENV["HOME"],".opentox","config","#{SERVICE}.rb") end before do |