Skip to content

Commit cd0ba91

Browse files
committedNov 23, 2017
Use layer context in RefactorFields algorithm
Fix #17533
1 parent 851adb0 commit cd0ba91

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎python/plugins/processing/algs/qgis/FieldsMapper.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ def prepareAlgorithm(self, parameters, context, feedback):
121121
da.setSourceCrs(source.sourceCrs())
122122
da.setEllipsoid(context.project().ellipsoid())
123123

124+
# create an expression context using thread safe processing context
125+
self.expr_context = self.createExpressionContext(parameters, context, source)
126+
124127
for field_def in mapping:
125128
self.fields.append(QgsField(name=field_def['name'],
126129
type=field_def['type'],
@@ -143,8 +146,6 @@ def outputFields(self, inputFields):
143146
return self.fields
144147

145148
def processAlgorithm(self, parameters, context, feeback):
146-
# create an expression context using thead safe processing context
147-
self.expr_context = self.createExpressionContext(parameters, context)
148149
for expression in self.expressions:
149150
expression.prepare(self.expr_context)
150151
self._row_number = 0

0 commit comments

Comments
 (0)
Please sign in to comment.