Skip to content

Commit

Permalink
tweak error messages for empty results in extent queries
Browse files Browse the repository at this point in the history
  • Loading branch information
Klaus Förster committed Jan 14, 2016
1 parent 2bb38d2 commit 8a26f6b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
22 changes: 14 additions & 8 deletions www/html/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,21 @@ def strips(req, cid=None, extent=None):
# split up campaign ID
[ptype,pname,cdate,cname] = util.parse_cid(cid)

# get shell commands and execute
# get shell commands
cmds = util.get_lascopy_cmds(cid,extent)
req.write('<h3>Daten im Downloadbereich bereitgestellt</h3>')
req.write('<pre><strong>Shell-Befehle:</strong>\n\n')
for args in cmds:
req.write('%s\n' % ' '.join(args) )
proc = Popen(args, stdout=PIPE, stderr=PIPE)
stdout, stderr = proc.communicate()
req.write('</pre>')

if type(cmds) == str:
# show errors
req.write('ERROR: %s' % cmds)
else:
# execute commands and give feedback
req.write('<h3>Daten im Downloadbereich bereitgestellt</h3>')
req.write('<pre><strong>Shell-Befehle:</strong>\n\n')
for args in cmds:
req.write('%s\n' % ' '.join(args) )
proc = Popen(args, stdout=PIPE, stderr=PIPE)
stdout, stderr = proc.communicate()
req.write('</pre>')

# finish
dbh.close()
Expand Down
7 changes: 4 additions & 3 deletions www/lib/Laser/Util/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ def get_lascopy_cmds(self, cid=None, ext=None):
)
cmds.append(['ln','-s',ipath,opath])

return cmds
if len(cmds) == 0:
return "no lasfiles found that intersect the extent"
else:
return cmds

def get_las2las_cmd(self, cid=None, ext=None):
""" transform extent in latlng to extent of campaign, create list with lasfiles to process and return las commandline args """
Expand Down Expand Up @@ -121,8 +124,6 @@ def get_las2las_cmd(self, cid=None, ext=None):
ptype,pname,cdate,cname
)
)
if self.base.dbh.rowcount() == 0:
return 'no lasfiles found'

# loop through results and fill las2las args
for row in self.base.dbh.fetchall():
Expand Down

0 comments on commit 8a26f6b

Please sign in to comment.