From 689ccc7e0caba76147dc1077d587a88950f4d3a3 Mon Sep 17 00:00:00 2001 From: lars Date: Wed, 30 Jan 2008 10:01:25 +0000 Subject: [PATCH] accept spaces in container names handle non-existent event plugin directory gracefully --- src/cryptobox/core/container.py | 2 +- src/cryptobox/core/main.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cryptobox/core/container.py b/src/cryptobox/core/container.py index b14d479..b40a07d 100644 --- a/src/cryptobox/core/container.py +++ b/src/cryptobox/core/container.py @@ -108,7 +108,7 @@ class CryptoBoxContainer: ## is the same as the volume name if self.is_mounted(): raise CBVolumeIsActive("the container must not be active during renaming") - if not re.search(r'^[a-zA-Z0-9_\.\-]+$', new_name): + if not re.match(r'[a-zA-Z0-9_\.\- ]+$', new_name): raise CBInvalidName("the supplied new name contains illegal characters") ## check for another partition with the same name if self.cbox.get_container_list(filter_name=new_name): diff --git a/src/cryptobox/core/main.py b/src/cryptobox/core/main.py index 9ce1d6d..3c60713 100644 --- a/src/cryptobox/core/main.py +++ b/src/cryptobox/core/main.py @@ -272,7 +272,12 @@ class CryptoBox: def send_event_notification(self, event, event_infos): """call all available scripts in the event directory with some event information""" event_dir = self.prefs["Locations"]["EventDir"] - for fname in os.listdir(event_dir): + try: + event_scripts = os.listdir(event_dir) + except OSError: + ## the directory does not seem to exist - we fail silently + return + for fname in event_scripts: real_fname = os.path.join(event_dir, fname) if os.path.isfile(real_fname) and os.access(real_fname, os.X_OK): cmd_args = [ self.prefs["Programs"]["super"],