accept spaces in container names

handle non-existent event plugin directory gracefully
This commit is contained in:
lars 2008-01-30 10:01:25 +00:00
parent d08dbb1957
commit 689ccc7e0c
2 changed files with 7 additions and 2 deletions

View File

@ -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):

View File

@ -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"],