Skip to content
Permalink
Browse files

[processing] correctly export multiline strings as python parameters …

…from modeler

fixes #13830
  • Loading branch information
volaya committed Dec 15, 2015
1 parent 7fc6b07 commit 95b92c79608afda0709dcdf8e89ee40b81a51ec7
Showing with 1 addition and 1 deletion.
  1. +1 −1 python/plugins/processing/modeler/ModelerAlgorithm.py
@@ -133,7 +133,7 @@ def _toString(v):
if isinstance(v, (ValueFromInput, ValueFromOutput)):
return v.asPythonParameter()
elif isinstance(v, basestring):
return "'%s'" % v
return "\\n".join(("'%s'" % v).splitlines())

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn Dec 15, 2015

Member

I realize that it's not new code, but .format() should be preferred over %

Quote:

Why would you not use it [.format()]?

  • not knowing about it (me before reading this)
  • having to be compatible with Python 2.5

http://stackoverflow.com/a/5082482/2319028

elif isinstance(v, list):
return "[%s]" % ",".join([_toString(val) for val in v])
else:

0 comments on commit 95b92c7

Please sign in to comment.
You can’t perform that action at this time.