@@ -211,12 +211,12 @@ def save(self) -> None:
211
211
ensure_dir (os .path .dirname (fname ))
212
212
213
213
# Ensure directory's permission(need to be writeable)
214
- if os . access ( fname , os . W_OK ) :
214
+ try :
215
215
with open (fname , "w" ) as f :
216
216
parser .write (f )
217
- else :
217
+ except IOError as error :
218
218
raise ConfigurationError (
219
- "Configuation file not writeable { }" .format (': ' . join ( fname ) )
219
+ "An error occurred while writing to the configuration file: {0} \n Error message: {1 }" .format (fname , error )
220
220
)
221
221
222
222
#
@@ -342,24 +342,10 @@ def iter_config_files(self) -> Iterable[Tuple[Kind, List[str]]]:
342
342
# at the base we have any global configuration
343
343
yield kinds .GLOBAL , config_files [kinds .GLOBAL ]
344
344
345
- site_accessable = int
346
- site_index = 0
347
- site_all_accessable = bool
348
-
349
- for fname in config_files [kinds .SITE ]:
350
- site_index += 1
351
- if os .access (fname , os .W_OK ):
352
- site_accessable += 1
353
-
354
- if site_accessable < site_index :
355
- site_all_accessable = False
356
- elif site_accessable == site_index :
357
- site_all_accessable = True
358
-
359
345
# per-user configuration next
360
346
should_load_user_config = not self .isolated and not (
361
347
config_file and os .path .exists (config_file )
362
- ) or not site_all_accessable == True
348
+ )
363
349
364
350
if should_load_user_config :
365
351
# The legacy config file is overridden by the new config file
0 commit comments