diff tincan.py @ 42:8948020c54fd draft

Remove some debug deadwood, ignore hidden files.
author David Barts <n5jrn@me.com>
date Wed, 29 May 2019 16:51:33 -0700
parents 9335865ae0bb
children 0bd9b9ae9998
line wrap: on
line diff
--- a/tincan.py	Wed May 29 09:47:27 2019 -0700
+++ b/tincan.py	Wed May 29 16:51:33 2019 -0700
@@ -430,13 +430,10 @@
                 mtime = os.fstat(fp.fileno()).st_mtime
                 bytes = fp.read()
         except FileNotFoundError as e:
-            print(e)  # debug
             return bottle.HTTPError(status=404, exception=e)
         except PermissionError as e:
-            print(e)  # debug
             return bottle.HTTPError(status=403, exception=e)
         except OSError as e:
-            print(e)  # debug
             return bottle.HTTPError(status=500, exception=e)
         # Establish preliminary standard headers.
         headers = {
@@ -811,6 +808,8 @@
 
     def _launch(self, subdir):
         for entry in os.listdir(os.path.join(self.fsroot, *subdir)):
+            if entry.startswith("."):
+                continue  # hidden file
             if not subdir and entry in _BANNED:
                 continue
             etype = os.stat(os.path.join(self.fsroot, *subdir, entry)).st_mode