Skip to content

Commit

Permalink
[Expression] Don't unregister function if not registering
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Nov 29, 2014
1 parent 7942325 commit 391d105
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/core/__init__.py
Expand Up @@ -47,7 +47,8 @@ def func(self, values, feature, parent):
if arg_count == 0 and not name[0] == '$':
name = '${0}'.format(name)

if QgsExpression.isFunctionName(name):
register = kwargs.get('register', True)
if register and QgsExpression.isFunctionName(name):
if not QgsExpression.unregisterFunction(name):
raise TypeError("Unable to unregister function")

Expand All @@ -57,7 +58,6 @@ def func(self, values, feature, parent):

# This doesn't really make any sense here but does when used from a decorator context
# so it can stay.
register = kwargs.get('register', True)
if register:
QgsExpression.registerFunction(f)
return f
Expand Down

0 comments on commit 391d105

Please sign in to comment.