Skip to content

Commit

Permalink
[processing] correctly export multiline strings as python parameters …
Browse files Browse the repository at this point in the history
…from modeler

fixes #13830
  • Loading branch information
volaya committed Dec 15, 2015
1 parent 7fc6b07 commit 95b92c7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/plugins/processing/modeler/ModelerAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 95b92c7

Please sign in to comment.