Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[processing] improve handling of the HTML outputs in GRASS provider (fix
  • Loading branch information
alexbruy authored and nyalldawson committed Jul 15, 2019
1 parent 81a59c2 commit 4b138d1
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 4 deletions.
14 changes: 11 additions & 3 deletions python/plugins/processing/algs/grass7/Grass7Algorithm.py
Expand Up @@ -631,9 +631,17 @@ def processCommand(self, parameters, context, feedback, delOutputs=False):
if outName in parameters and parameters[outName] is not None:
# for HTML reports, we need to redirect stdout
if out.defaultFileExtension().lower() == 'html':
command += ' {}=- > "{}"'.format(
outName,
self.parameterAsFileOutput(parameters, outName, context))
if outName == 'html':
# for "fake" outputs redirect command stdout
command += ' > "{}"'.format(
self.parameterAsFileOutput(
parameters, outName, context)
)
else:
# for real outputs only output itself should be redirected
command += ' {}=- > "{}"'.format(
outName,
self.parameterAsFileOutput(parameters, outName, context))
else:
command += ' {}="{}"'.format(
outName,
Expand Down
Expand Up @@ -3,4 +3,4 @@ v.net.report - Reports lines information of a network
Vector (v.*)
QgsProcessingParameterFeatureSource|input|Input vector line layer (arcs)|1|None|False
Hardcoded|operation=report
QgsProcessingParameterFileDestination|output|Report|Html files (*.html)|None|False
QgsProcessingParameterFileDestination|html|Report|Html files (*.html)|None|False
@@ -0,0 +1,11 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><p>cat|fid|id|id2|x|y|z
</br>6|points.5|6|0|0|-5|0
</br>9|points.8|9|0|0|-1|0
</br>1|points.0|1|2|1|1|0
</br>3|points.2|3|0|2|2|0
</br>2|points.1|2|1|3|3|0
</br>5|points.4|5|1|4|1|0
</br>4|points.3|4|2|5|2|0
</br>8|points.7|8|0|7|-1|0
</br>7|points.6|7|0|8|-1|0
</br></p></body></html>
Expand Up @@ -519,3 +519,23 @@ tests:
compare:
fields:
fid: skip

- algorithm: grass7:v.report
name: v.report - Reports geometry statistics for vector maps
params:
GRASS_MIN_AREA_PARAMETER: 0.0001
GRASS_SNAP_TOLERANCE_PARAMETER: -1.0
map:
name: points.gml|layername=points
type: vector
option: 2
sort: 0
units: 2
results:
html:
name: expected/grass7/v_report.html
type: regex
rules:
- 'cat|fid|id|id2|x|y|z'
- '6|points.5|6|0|0|-5|0'
- '8|points.7|8|0|7|-1|0'

0 comments on commit 4b138d1

Please sign in to comment.