Skip to content
Permalink
Browse files

Adapt “@qgsfunction" decorator to new expression structure

  • Loading branch information
m-kuhn committed May 19, 2017
1 parent e02cd57 commit 1e4c1595c047e48fe69d8adbd201a6602758f1bb
Showing with 3 additions and 3 deletions.
  1. +3 −3 python/core/__init__.py
@@ -71,10 +71,10 @@ def myfunc(values, *args):
:param usesgeometry:
:return:
"""
class QgsExpressionFunction(QgsExpression.Function):
class QgsPyExpressionFunction(QgsExpressionFunction):

def __init__(self, func, name, args, group, helptext='', usesGeometry=True, referencedColumns=QgsFeatureRequest.ALL_ATTRIBUTES, expandargs=False):
QgsExpression.Function.__init__(self, name, args, group, helptext)
QgsExpressionFunction.__init__(self, name, args, group, helptext)
self.function = func
self.expandargs = expandargs
self.uses_geometry = usesGeometry
@@ -132,7 +132,7 @@ def referencedColumns(self, node):

function.__name__ = name
helptext = helptemplate.safe_substitute(name=name, doc=helptext)
f = QgsExpressionFunction(function, name, arg_count, group, helptext, usesgeometry, referenced_columns, expandargs)
f = QgsPyExpressionFunction(function, name, arg_count, group, helptext, usesgeometry, referenced_columns, expandargs)

# This doesn't really make any sense here but does when used from a decorator context
# so it can stay.

0 comments on commit 1e4c159

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