if (ret instanceof PyString) {
getResponse().setEntity(ret.toString(), mediaType);
}
else if (ret instanceof PyList) {
final PyList list = (PyList) ret;
getResponse().setEntity(new OutputRepresentation(mediaType) {
@Override
public void write(OutputStream outputStream) throws IOException {
for (Iterator i = list.iterator(); i.hasNext();) {
outputStream.write(i.next().toString().getBytes());
outputStream.write('\n');
}
}
});