Browse Source

Raise the correct exception if the site isn't found

tags/v0.1^2
Ben Kurtovic 12 years ago
parent
commit
9e5805c6cf
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      earwigbot/wiki/sitesdb.py

+ 2
- 1
earwigbot/wiki/sitesdb.py View File

@@ -193,7 +193,8 @@ class SitesDBManager(object):
query = "SELECT site_name FROM sites WHERE site_project = ? and site_lang = ?" query = "SELECT site_name FROM sites WHERE site_project = ? and site_lang = ?"
with sqlite.connect(self._sitesdb) as conn: with sqlite.connect(self._sitesdb) as conn:
try: try:
return conn.execute(query, (project, lang)).fetchone()[0]
site = conn.execute(query, (project, lang)).fetchone()
return site[0] if site else None
except sqlite.OperationalError: except sqlite.OperationalError:
self._create_sitesdb() self._create_sitesdb()




Loading…
Cancel
Save