1. Daniel Holth
  2. flickzeug


s0undt3ch  committed 214f39a

Check for write permissions for the passed `profile_data_path` directory. Thanks `jokey`!

  • Participants
  • Parent commits e86b1dd
  • Branches default

Comments (0)

Files changed (1)

File flickzeug/profiling/profiler.py

View file
  • Ignore whitespace
 import random
 import time
 from datetime import datetime
-from os import listdir, stat, unlink
+from os import access, listdir, stat, unlink, W_OK
 from os.path import isdir, isfile, join
 from werkzeug.routing import Rule
         WebMiddleware.__init__(self, app, app_path)
         if not isdir(profile_data_path):
-            raise RuntimeError('The directory for "profile_data_path" does '
-                               'not exist. Please create it.')
+            raise RuntimeError('The directory for "profile_data_path", %r, does'
+                               ' not exist. Please create it.' %
+                               profile_data_path)
+        elif not access(profile_data_path, W_OK):
+            raise RuntimeError('Can\'t write to %r. Please correct this.' %
+                               profile_data_path)
         self.profile_path = profile_data_path
         if profile_filter is Ellipsis:
             profile_filter = lambda env: True