myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [2115] trunk: fixed workflow model so that conten


From: noreply
Subject: [myexperiment-hackers] [2115] trunk: fixed workflow model so that content is required
Date: Fri, 6 Mar 2009 10:58:47 -0500 (EST)

Revision
2115
Author
dgc
Date
2009-03-06 10:58:46 -0500 (Fri, 06 Mar 2009)

Log Message

fixed workflow model so that content is required

Modified Paths

Diff

Modified: trunk/app/models/workflow.rb (2114 => 2115)


--- trunk/app/models/workflow.rb	2009-03-06 15:29:04 UTC (rev 2114)
+++ trunk/app/models/workflow.rb	2009-03-06 15:58:46 UTC (rev 2115)
@@ -89,6 +89,7 @@
   
   validates_inclusion_of :license, :in => [ "by-nd", "by-sa", "by" ]
   
+  validates_presence_of :content_blob
   validates_presence_of :content_type
 
   file_column :image, :magick => {

Modified: trunk/lib/rest.rb (2114 => 2115)


--- trunk/lib/rest.rb	2009-03-06 15:29:04 UTC (rev 2114)
+++ trunk/lib/rest.rb	2009-03-06 15:58:46 UTC (rev 2115)
@@ -525,12 +525,14 @@
 
   workflow = Workflow.new(:contributor => user)
 
+  content = Base64.decode64(elements["content"]) if elements["content"]
+
   workflow.title        = elements["title"]        if elements["title"]
   workflow.body         = elements["description"]  if elements["description"]
   workflow.license      = elements["license_type"] if elements["license_type"]
   workflow.content_type = elements["content_type"] if elements["content_type"]
 
-  workflow.content_blob = ContentBlob.new(:data ="" Base64.decode64(elements["content"])) if elements["content"]
+  workflow.content_blob = ContentBlob.new(:data ="" content) if content
 
   # Handle the preview and svg images.  If there's a preview supplied, use it.
   # Otherwise auto-generate one if we can.
@@ -548,7 +550,7 @@
 
     image.close
 
-  elsif workflow.processor_class and workflow.processor_class.can_generate_preview?
+  elsif content and workflow.processor_class and workflow.processor_class.can_generate_preview?
 
     processor = workflow.processor_class.new(content)
     workflow.image, workflow.svg = processor.get_preview_images

reply via email to

[Prev in Thread] Current Thread [Next in Thread]