summaryrefslogtreecommitdiff
path: root/portato/db/eix_sql.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--portato/db/eix_sql.py7
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