commit:     5fa31f084469c2a0fc72fba1bffd7bfb3f0384e8
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 13 02:38:14 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sat Jun 13 02:38:14 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=5fa31f08

flocker.py: Removes assert for more verbose exception

 layman/flocker.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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)

Reply via email to