diff bin/effecteval @ 1103:771f50f19b4b

single-line effect code now evals by changing <uri> into a suitable python object Ignore-this: cde829f021be54bc7cfd63bddde43aa9
author Drew Perttula <drewp@bigasterisk.com>
date Mon, 09 Jun 2014 07:10:39 +0000
parents 3074f635ee23
children 512381de45bd
line wrap: on
line diff
--- a/bin/effecteval	Mon Jun 09 03:56:44 2014 +0000
+++ b/bin/effecteval	Mon Jun 09 07:10:39 2014 +0000
@@ -53,7 +53,7 @@
             (song, L9['effect'], effect, ctx),
             (effect, RDF.type, L9['Effect'], ctx),
             (effect, L9['code'],
-             Literal('out = sub(%s, intensity=%s)' % (dropped.n3(), curve.n3())),
+             Literal('out = %s * %s' % (dropped.n3(), curve.n3())),
              ctx),
             ]))
         
@@ -102,13 +102,15 @@
     def put(self):
         effect = URIRef(self.get_argument('uri'))
         code = Literal(self.get_argument('code'))
-        with self.settings.graph.currentState(tripleFilter=(None, L9['effect'], effect)) as g:
+        with self.settings.graph.currentState(
+                tripleFilter=(None, L9['effect'], effect)) as g:
             song = g.subjects(L9['effect'], effect).next()
         self.settings.graph.patchObject(
             context=song,
             subject=effect,
             predicate=L9['code'],
             newObject=code)
+        # right here we could tell if the code has a python error and return it
         self.send_error(202)
         
 class EffectEval(PrettyErrorHandler, cyclone.web.RequestHandler):