Skip to content
Permalink
Browse files

Fix #13059 - Fix expression template load error

  • Loading branch information
NathanW2 committed Jul 4, 2015
1 parent 4bff1e0 commit fbad68075b71e29c3384f63f1bbb3593d61d6853
Showing with 15 additions and 12 deletions.
  1. +15 −12 python/user.py
@@ -44,23 +44,26 @@ def load_user_expressions(path):
if not os.path.exists(initfile):
open(initfile, "w").close()

template = """\"\"\"
Define new functions using @qgsfunction. feature and parent must always be the
last args. Use args=-1 to pass a list of values as arguments
\"\"\"
from qgis.core import *
from qgis.gui import *
@qgsfunction(args='auto', group='Custom')
def func(value1, feature, parent):
return value1
"""


try:
import expressions

expressions.load = load_user_expressions
expressions.load(expressionspath)
expressions.template = """\"\"\"
Define new functions using @qgsfunction. feature and parent must always be the
last args. Use args=-1 to pass a list of values as arguments
\"\"\"
from qgis.core import *
from qgis.gui import *
@qgsfunction(args='auto', group='Custom')
def func(value1, feature, parent):
return value1
"""
expressions.template = template
except ImportError:
# We get a import error and crash for some reason even if we make the expressions package
# TODO Fix the crash on first load with no expressions folder

0 comments on commit fbad680

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