Skip to content

Commit 45e712f

Browse files
committed
Merge pull request #1432 from gvellut/master
Fix #9020
2 parents a59b54e + 1357c14 commit 45e712f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

python/utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,21 +418,22 @@ def add(values, *args):
418418
"""
419419
helptemplate = Template("""<h3>$name function</h3><br>$doc""")
420420
class QgsExpressionFunction(QgsExpression.Function):
421-
def __init__(self, name, args, group, helptext=''):
422-
QgsExpression.Function.__init__(self, name, args, group, helptext)
421+
def __init__(self, name, args, group, helptext='', usesgeometry=False):
422+
QgsExpression.Function.__init__(self, name, args, group, helptext, usesgeometry)
423423

424424
def func(self, values, feature, parent):
425425
pass
426426

427427
def wrapper(func):
428428
name = kwargs.get('name', func.__name__)
429+
usesgeometry = kwargs.get('usesgeometry', False)
429430
help = func.__doc__ or ''
430431
help = help.strip()
431432
if args == 0 and not name[0] == '$':
432433
name = '${0}'.format(name)
433434
func.__name__ = name
434435
help = helptemplate.safe_substitute(name=name, doc=help)
435-
f = QgsExpressionFunction(name, args, group, help)
436+
f = QgsExpressionFunction(name, args, group, help, usesgeometry)
436437
f.func = func
437438
register = kwargs.get('register', True)
438439
if register:

0 commit comments

Comments
 (0)