Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-11-23 10:24:02 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-11-23 10:26:01 (GMT)
commit4118839fc65b790908f02d5fda722fb5b834df69 (patch)
treeb39112489196536b2293f84e4a7e2b76d7f9ca50
parent726025bffc1532a283ee9dcb93aaf91a23ca9145 (diff)
Make reading version file more robust (sayamindu) #1562
-rw-r--r--src/carquinyol/layoutmanager.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/carquinyol/layoutmanager.py b/src/carquinyol/layoutmanager.py
index dc3fde6..688b6bd 100644
--- a/src/carquinyol/layoutmanager.py
+++ b/src/carquinyol/layoutmanager.py
@@ -15,6 +15,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import os
+import logging
MAX_QUERY_LIMIT = 40960
@@ -46,7 +47,12 @@ class LayoutManager(object):
version_path = os.path.join(self._root_path, 'version')
version = 0
if os.path.exists(version_path):
- version = int(open(version_path, 'r').read())
+ try:
+ version = int(open(version_path, 'r').read())
+ except ValueError:
+ logging.exception('Can not read layout version')
+ version = 0
+
return version
def set_version(self, version):