Skip to content

Commit

Permalink
Use layer context in RefactorFields algorithm
Browse files Browse the repository at this point in the history
Fix #17533
  • Loading branch information
m-kuhn committed Nov 23, 2017
1 parent 851adb0 commit cd0ba91
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/plugins/processing/algs/qgis/FieldsMapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ def prepareAlgorithm(self, parameters, context, feedback):
da.setSourceCrs(source.sourceCrs())
da.setEllipsoid(context.project().ellipsoid())

# create an expression context using thread safe processing context
self.expr_context = self.createExpressionContext(parameters, context, source)

for field_def in mapping:
self.fields.append(QgsField(name=field_def['name'],
type=field_def['type'],
Expand All @@ -143,8 +146,6 @@ def outputFields(self, inputFields):
return self.fields

def processAlgorithm(self, parameters, context, feeback):
# create an expression context using thead safe processing context
self.expr_context = self.createExpressionContext(parameters, context)
for expression in self.expressions:
expression.prepare(self.expr_context)
self._row_number = 0
Expand Down

0 comments on commit cd0ba91

Please sign in to comment.