summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Gütlein <martin.guetlein@gmail.com>2010-02-17 09:58:27 +0100
committerMartin Gütlein <martin.guetlein@gmail.com>2010-02-17 09:58:27 +0100
commitd724cd5432162a38e51422d4877cc4ba5bd52dec (patch)
treedae61ff0247e2ca1e83bccfc50cb8c53beb2039b
parent34fe4a160ca7002e2b166925c6721e9ba9871b3e (diff)
file and uri length 255, copy paste error fixed, auto migrate when delete all
-rw-r--r--application.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/application.rb b/application.rb
index 8464e89..ec54d97 100644
--- a/application.rb
+++ b/application.rb
@@ -5,8 +5,8 @@ require 'opentox-ruby-api-wrapper'
class Dataset
include DataMapper::Resource
property :id, Serial
- property :uri, String, :length => 100
- property :file, String
+ property :uri, String, :length => 255
+ property :file, String, :length => 255
#property :owl, Text, :length => 1000000
property :created_at, DateTime
@@ -42,7 +42,7 @@ get '/:id/?' do
when /rdf/ # redland sends text/rdf instead of application/rdf+xml
dataset.owl
when /yaml/
- OpenTox::Dataset.find(uri).to_yaml
+ OpenTox::Dataset.find(dataset.uri).to_yaml
else
halt 400, "Unsupported MIME type '#{accept}'"
end
@@ -80,7 +80,7 @@ post '/?' do
LOGGER.debug "Saving dataset #{uri}."
begin
dataset.owl = d.rdf
- dataset.uri = uri
+ dataset.uri = uri
dataset.save
task.completed(uri)
rescue => e
@@ -93,6 +93,10 @@ post '/?' do
task.pid = pid
#status 303 # rest client tries to redirect
task.uri
+
+
+
+
end
delete '/:id/?' do
@@ -107,13 +111,15 @@ delete '/:id/?' do
end
delete '/?' do
+
Dataset.all.each do |d|
begin
File.delete d.file
rescue
LOGGER.error "Cannot delete dataset file '#{d.file}'"
end
- d.destroy!
+ #d.destroy!
end
+ Dataset.auto_migrate!
"All datasets deleted."
end