diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2010-05-20 13:02:29 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2010-05-20 13:02:29 +0200 |
commit | bf961022b5e191e897e68f69784425d2c8166968 (patch) | |
tree | 4ee5915bf8bb01e3cb174179739ff1b8dd38a08f /portato | |
parent | 261b162f4512609fb8fabd23f44e6ddc0536d43b (diff) | |
download | portato-bf961022b5e191e897e68f69784425d2c8166968.tar.gz portato-bf961022b5e191e897e68f69784425d2c8166968.tar.bz2 portato-bf961022b5e191e897e68f69784425d2c8166968.zip |
Handle missing eix-cache file more gracefully
Diffstat (limited to '')
-rw-r--r-- | portato/db/eix_sql.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/portato/db/eix_sql.py b/portato/db/eix_sql.py index 758f42c..58b0acc 100644 --- a/portato/db/eix_sql.py +++ b/portato/db/eix_sql.py @@ -20,10 +20,14 @@ except ImportError: import os from .sql import SQLDatabase +from .exceptions import DatabaseInitError from ..eix import EixReader from ..helper import debug, warning from ..backend import system +class EixInitError (DatabaseInitError): + pass + class EixSQLDatabase (SQLDatabase): CACHE_FILE = "/var/cache/eix" @@ -35,6 +39,9 @@ class EixSQLDatabase (SQLDatabase): warning(_("Cache file '%s' does not exist. Using default instead."), self.cache) self.cache = self.CACHE_FILE + if not os.path.exists(self.cache): + raise EixInitError(_("Cache file '%s' does not exist.") % self.cache) + debug("Using '%s' as eix cache file.", self.cache) session["cache"] = self.cache |