aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevan Franchini <twitch153@gentoo.org>2015-06-12 22:38:14 -0400
committerDevan Franchini <twitch153@gentoo.org>2015-06-12 22:38:14 -0400
commit5fa31f084469c2a0fc72fba1bffd7bfb3f0384e8 (patch)
treee9037aa175c8b8e2e098404ecf9fdace4d6f27fd
parentflocker.py: Adds check to ensure get_file isn't passing a closed io object (diff)
downloadlayman-5fa31f084469c2a0fc72fba1bffd7bfb3f0384e8.tar.gz
layman-5fa31f084469c2a0fc72fba1bffd7bfb3f0384e8.tar.bz2
layman-5fa31f084469c2a0fc72fba1bffd7bfb3f0384e8.zip
flocker.py: Removes assert for more verbose exception
-rw-r--r--layman/flocker.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/layman/flocker.py b/layman/flocker.py
index 36a12b8..aa5f3f8 100644
--- a/layman/flocker.py
+++ b/layman/flocker.py
@@ -70,7 +70,8 @@ class FileLocker(object):
def get_file(self, path, mode='r'):
'''Obtains file object for given path'''
- assert mode in ('r', 'w+')
+ if mode not in ('r', 'w+'):
+ raise LockingException('Invalid mode %(mode)s' % {'mode': mode})
if path not in self.files or self.files[path].closed:
self.files[path] = fileopen(path, mode)