- self.setWindowTitle ("BiaWeb - " + self.current_db)
- self.repopulate_categories ()
- self.repopulate_articles ()
+
+ # added to check whether categories are loaded successfully or not
+ # if not, then reset the current_db to None
+ loaded_cats = self.repopulate_categories ()
+ loaded_arts = self.repopulate_articles ()
+ # if failed in loading either categories or articles (note: checking against
+ # False and not None)
+ if loaded_cats == False or loaded_arts == False:
+ self.current_db = None
+ PyQt4.QtGui.QMessageBox.critical (self, "Error",
+ "SQLite 3 error in loading site database. This appears to be an invalid BiaWeb database")
+ else:
+ # set the window title to the database
+ self.setWindowTitle ("BiaWeb - " + self.current_db)
+