camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CAMEL-7582) Python scripts with multiple statements return null
Date Wed, 23 Jul 2014 08:19:39 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-7582?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Claus Ibsen resolved CAMEL-7582.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 2.14.0
         Assignee: Willem Jiang

> Python scripts with multiple statements return null
> ---------------------------------------------------
>
>                 Key: CAMEL-7582
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7582
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-language
>    Affects Versions: 2.13.0
>            Reporter: Tim Dudgeon
>            Assignee: Willem Jiang
>            Priority: Minor
>             Fix For: 2.14.0
>
>
> As reported here: 
> http://camel.465427.n5.nabble.com/Return-Value-from-Python-Script-Not-In-Message-Body-tt5724056.html#none
> It seems that when calling python script that has more than a single statement  the return
value from the script is null. Here is a simple example in groovy that  shows this:
> {code}
> package com.im.examples
> import org.apache.camel.*
> import org.apache.camel.impl.*
> import org.apache.camel.builder.*
> String script = URLEncoder.encode('"Hello world!"', "UTF-8") // this works - script returns
"Hello world!"
> //String script = URLEncoder.encode('bar = "baz"; "Hello world!"', "UTF-8") // this fails
- script returns null
> CamelContext camelContext = new DefaultCamelContext()
> camelContext.addRoutes(new RouteBuilder() {
>         def void configure() {
>             from("direct:python")
>             .to("language:python:" + script)
>         }
>     }
> )
> camelContext.start()
> ProducerTemplate t = camelContext.createProducerTemplate()
> def result = t.requestBody('direct:python', 'foo')
> println result
> camelContext.stop()
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message