From baecdfe03a6bff2ee28d687f77b1c6606e102003 Mon Sep 17 00:00:00 2001 From: mr Date: Tue, 14 Dec 2010 12:47:16 +0100 Subject: remove token_id from saving in table --- application.rb | 6 ++++-- lazar.rb | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/application.rb b/application.rb index f11a211..7935577 100644 --- a/application.rb +++ b/application.rb @@ -4,13 +4,15 @@ require 'opentox-ruby' class ModelStore include DataMapper::Resource - attr_accessor :prediction_dataset + attr_accessor :prediction_dataset, :token_id property :id, Serial property :uri, String, :length => 255 property :yaml, Text, :length => 2**32-1 - property :token_id, String, :length => 255 + #property :token_id, String, :length => 255 property :created_at, DateTime + @token_id = nil + after :save, :check_policy private diff --git a/lazar.rb b/lazar.rb index c565a74..e930f15 100644 --- a/lazar.rb +++ b/lazar.rb @@ -69,6 +69,8 @@ end # @param [optional,Header] Accept Content-type of prediction, can be either `application/rdf+xml or application/x-yaml` # @return [text/uri-list] URI of prediction task (dataset prediction) or prediction dataset (compound prediction) post '/:id/?' do + token_id = params[:token_id] if params[:token_id] + token_id = request.env["HTTP_TOKEN_ID"] if !token_id and request.env["HTTP_TOKEN_ID"] @lazar = YAML.load ModelStore.get(params[:id]).yaml @@ -81,7 +83,7 @@ post '/:id/?' do cache = PredictionCache.first(:model_uri => @lazar.uri, :compound_uri => compound_uri) return cache.dataset_uri if cache and uri_available?(cache.dataset_uri) begin - prediction_uri = @lazar.predict(compound_uri,true).uri + prediction_uri = @lazar.predict(compound_uri,true,token_id).uri PredictionCache.create(:model_uri => @lazar.uri, :compound_uri => compound_uri, :dataset_uri => prediction_uri) prediction_uri rescue -- cgit v1.2.3