accept spaces in container names
handle non-existent event plugin directory gracefully
This commit is contained in:
parent
d08dbb1957
commit
689ccc7e0c
|
@ -108,7 +108,7 @@ class CryptoBoxContainer:
|
||||||
## is the same as the volume name
|
## is the same as the volume name
|
||||||
if self.is_mounted():
|
if self.is_mounted():
|
||||||
raise CBVolumeIsActive("the container must not be active during renaming")
|
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")
|
raise CBInvalidName("the supplied new name contains illegal characters")
|
||||||
## check for another partition with the same name
|
## check for another partition with the same name
|
||||||
if self.cbox.get_container_list(filter_name=new_name):
|
if self.cbox.get_container_list(filter_name=new_name):
|
||||||
|
|
|
@ -272,7 +272,12 @@ class CryptoBox:
|
||||||
def send_event_notification(self, event, event_infos):
|
def send_event_notification(self, event, event_infos):
|
||||||
"""call all available scripts in the event directory with some event information"""
|
"""call all available scripts in the event directory with some event information"""
|
||||||
event_dir = self.prefs["Locations"]["EventDir"]
|
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)
|
real_fname = os.path.join(event_dir, fname)
|
||||||
if os.path.isfile(real_fname) and os.access(real_fname, os.X_OK):
|
if os.path.isfile(real_fname) and os.access(real_fname, os.X_OK):
|
||||||
cmd_args = [ self.prefs["Programs"]["super"],
|
cmd_args = [ self.prefs["Programs"]["super"],
|
||||||
|
|
Loading…
Reference in a new issue