Skip to content
Permalink
Browse files

[py3] Compat update process_function_template.py

  • Loading branch information
m-kuhn committed Nov 8, 2015
1 parent 313c34c commit dea8c9f6e83ec9b9d7ba63799f816fd7ecfa6659
Showing with 10 additions and 3 deletions.
  1. +10 −3 scripts/process_function_template.py
@@ -3,6 +3,13 @@
import json
import glob

sys.path.append(
os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'../python/ext-libs'))

from six import string_types

cpp = open(sys.argv[1], "w")
cpp.write(
"#include \"qgsexpression.h\"\n"
@@ -24,7 +31,7 @@ def quote(v):
elif isinstance(v, list):
return map(quote, v)

elif isinstance(v, str) or isinstance(v, unicode):
elif isinstance(v, string_types):
return v.replace('"', '\\"').replace('\n', '\\n')

elif isinstance(v, bool):
@@ -38,7 +45,7 @@ def quote(v):
try:
json_params = json.load(function_file)
except:
print f
print(f)
raise

json_params = quote(json_params)
@@ -66,7 +73,7 @@ def quote(v):
for v in json_params['variants']:
if not 'arguments' in v:
raise BaseException("%s: arguments expected for operator")
if len(v['arguments']) < 1 or len(v['arguments']) > 2:
if len(list(v['arguments'])) < 1 or len(list(v['arguments'])) > 2:
raise BaseException("%s: 1 or 2 arguments expected for operator")

cpp.write("\n\n gFunctionHelpTexts.insert( {0},\n Help( {0}, tr( \"{1}\" ), tr( \"{2}\" ),\n QList<HelpVariant>()".format(

0 comments on commit dea8c9f

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