summaryrefslogtreecommitdiff
path: root/lazar.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lazar.rb')
-rw-r--r--lazar.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lazar.rb b/lazar.rb
index eee875a..0fd4634 100644
--- a/lazar.rb
+++ b/lazar.rb
@@ -288,8 +288,10 @@ end
post '/?' do # create model
halt 400, "MIME type \"#{request.content_type}\" not supported." unless request.content_type.match(/yaml/)
- model = Lazar.new
+ model = Lazar.new
model.save
+ model.token_id = params[:token_id] if params[:token_id]
+ model.token_id = request.env["HTTP_TOKEN_ID"] if !model.token_id and request.env["HTTP_TOKEN_ID"]
model.uri = url_for("/#{model.id}", :full)
model.yaml = request.env["rack.input"].read
model.save
@@ -304,6 +306,8 @@ post '/:id/?' do # create prediction
@prediction = OpenTox::Dataset.new
@prediction.creator = lazar.uri
+ @prediction.token_id = params[:token_id]
+ @prediction.token_id = request.env["HTTP_TOKEN_ID"] if !@prediction.token_id and request.env["HTTP_TOKEN_ID"]
dependent_variable = YAML.load(lazar.yaml).dependentVariables
@prediction.title = URI.decode(dependent_variable.split(/#/).last)
case dependent_variable
@@ -335,7 +339,6 @@ post '/:id/?' do # create prediction
else
halt 400, "MIME type \"#{request.env['HTTP_ACCEPT']}\" not supported."
end
-
elsif dataset_uri
response['Content-Type'] = 'text/uri-list'
task_uri = OpenTox::Task.as_task do