For jython, wrap native values properly using Py.java2py().
git-svn-id: http://google-refine.googlecode.com/svn/trunk@478 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
6be29f712c
commit
2277f45ef6
@ -49,7 +49,7 @@ public class JythonEvaluable implements Evaluable {
|
|||||||
|
|
||||||
return unwrap(result);
|
return unwrap(result);
|
||||||
} catch (PyException e) {
|
} catch (PyException e) {
|
||||||
return new EvalError(e.toString());
|
return new EvalError(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@ package com.metaweb.gridworks.expr;
|
|||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.python.core.Py;
|
||||||
import org.python.core.PyObject;
|
import org.python.core.PyObject;
|
||||||
import org.python.core.PyString;
|
|
||||||
|
|
||||||
public class JythonHasFieldsWrapper extends PyObject {
|
public class JythonHasFieldsWrapper extends PyObject {
|
||||||
private static final long serialVersionUID = -1275353513262385099L;
|
private static final long serialVersionUID = -1275353513262385099L;
|
||||||
@ -21,12 +21,12 @@ public class JythonHasFieldsWrapper extends PyObject {
|
|||||||
String k = (String) key.__tojava__(String.class);
|
String k = (String) key.__tojava__(String.class);
|
||||||
Object v = _obj.getField(k, _bindings);
|
Object v = _obj.getField(k, _bindings);
|
||||||
if (v != null) {
|
if (v != null) {
|
||||||
if (v instanceof HasFields) {
|
if (v instanceof PyObject) {
|
||||||
return new JythonHasFieldsWrapper((HasFields) v, _bindings);
|
|
||||||
} else if (v instanceof String) {
|
|
||||||
return new PyString((String) v);
|
|
||||||
} else if (v instanceof PyObject) {
|
|
||||||
return (PyObject) v;
|
return (PyObject) v;
|
||||||
|
} else if (v instanceof HasFields) {
|
||||||
|
return new JythonHasFieldsWrapper((HasFields) v, _bindings);
|
||||||
|
} else if (Py.getAdapter().canAdapt(v)) {
|
||||||
|
return Py.java2py(v);
|
||||||
} else {
|
} else {
|
||||||
return new JythonObjectWrapper(v);
|
return new JythonObjectWrapper(v);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user