diff options
Diffstat (limited to 'core/view_surveys.py')
-rw-r--r-- | core/view_surveys.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/view_surveys.py b/core/view_surveys.py index a70fa3d..9b9c533 100644 --- a/core/view_surveys.py +++ b/core/view_surveys.py @@ -15,17 +15,20 @@ import parsers.surveys '''Some of these views serve files as binary blobs, and simply set the mime type based on the file extension, as does the urls.py dispatcher which sends them here. Here they should actually have the filetype checked by looking inside the file before being served. + + need to check if inavlid query string is invalid, or produces multiple replies + and render a user-friendly error page. ''' def surveyscansfolder(request, path): #print [ s.walletname for s in ScansFolder.objects.all() ] - scansfolder = ScansFolder.objects.get(walletname=urlunquote(path)) + scansfolder = ScansFolder.objects.get(walletname=urlunquote(path)) # need to check if inavlid query string and produce friendly error return render(request, 'scansfolder.html', { 'scansfolder':scansfolder, 'settings': settings }) def surveyscansingle(request, path, file): '''sends a single binary file to the user, ''' - scansfolder = ScansFolder.objects.get(walletname=urlunquote(path)) + scansfolder = ScansFolder.objects.get(walletname=urlunquote(path)) # need to check if inavlid query string and produce friendly error singlescan = SingleScan.objects.get(scansfolder=scansfolder, name=file) # print(" - surveyscansingle {}:{}:{}:".format(path, file, flatviews.getmimetype(file))) return HttpResponse(content=open(singlescan.ffile,"rb"), content_type=flatviews.getmimetype(file)) # any type of image @@ -44,12 +47,12 @@ def tunneldata(request): def tunnelfilesingle(request, path): '''sends a single binary file to the user, We should have a renderer that syntax-colours this Tunnel xml ''' - tunnelfile = TunnelFile.objects.get(tunnelpath=urlunquote(path)) + tunnelfile = TunnelFile.objects.get(tunnelpath=urlunquote(path)) # need to check if inavlid query string and produce friendly error tfile = Path(settings.TUNNEL_DATA, tunnelfile.tunnelpath) return HttpResponse(content=open(tfile), content_type="text/xhtml") # for display not download def tunnelfileupload(request, path): - tunnelfile = TunnelFile.objects.get(tunnelpath=urlunquote(path)) + tunnelfile = TunnelFile.objects.get(tunnelpath=urlunquote(path)) # need to check if inavlid query string and produce friendly error tfile = Path(settings.TUNNEL_DATA, tunnelfile.tunnelpath) project, user, password, tunnelversion = request.POST["tunnelproject"], request.POST["tunneluser"], request.POST["tunnelpassword"], request.POST["tunnelversion"] |