def next_step(self): self.wizard.create_examples = not self.empty_database_radio.get_active( ) if self.wizard.db_is_local and not test_local_database(): return InstallPostgresStep(self.wizard, self) else: return CreateDatabaseStep(self.wizard, self)
def next_step(self): if self.done or test_local_database(): return CreateDatabaseStep(self.wizard, self) if self._can_install(): self._install_postgres() else: warning(_("You need to install PostgreSQL before moving forward")) return self
def check_incomplete_database(self): logger.info('check_incomplete_database (db_is_local=%s)' % (self.db_is_local, )) # If we don't have postgres installed we cannot have # an incomplete database if self.db_is_local and not test_local_database(): return False # a database which doesn't exist isn't incomplete try: if not self.settings.has_database(): return False except DatabaseError as e: # If we're install stoq locally and hasn't created a database # user yet, we'll receive an authentiction error, there's no # way to reliably check for this, so assume all errors are # authentication errors # first install on 9.1: FATAL: role "stoq" does not exist. if self.db_is_local: return False msg = (_('It was not possible to connect to the database.') + '\n' + _('Check the server configuration and try again.')) warning(msg, str(e)) return True # If we have the SystemTable we are pretty much there, # could verify a few more tables in the future, including # row content of the tables. store = self.settings.create_store() if SystemTable.is_available(store): store.close() return False store.close() # okay, we have a database which exists and doesn't have # the "SystemTable" SQL table present, means that we cannot use # it and should warn the user # Not 100% correct, should perhaps say "unix socket" address = self.settings.address or "localhost" msg = _("Database {dbname} at {address}:{port} is not " "a Stoq database.").format( dbname=self.settings.dbname, address=address, port=self.settings.port) description = _( "Stoq was able to succesfully connect to the database " "{dbname} at the database server {address}, however it " "is not a Stoq database or it was corrupted, please select " "another one.").format(dbname=self.settings.dbname, address=self.settings.address or "localhost") warning(msg, description) return True
def check_incomplete_database(self): logger.info('check_incomplete_database (db_is_local=%s)' % (self.db_is_local, )) # If we don't have postgres installed we cannot have # an incomplete database if self.db_is_local and not test_local_database(): return False # a database which doesn't exist isn't incomplete try: if not self.settings.has_database(): return False except DatabaseError as e: # If we're install stoq locally and hasn't created a database # user yet, we'll receive an authentiction error, there's no # way to reliably check for this, so assume all errors are # authentication errors # first install on 9.1: FATAL: role "stoq" does not exist. if self.db_is_local: return False msg = (_('It was not possible to connect to the database.') + '\n' + _('Check the server configuration and try again.')) warning(msg, str(e)) return True # If we have the SystemTable we are pretty much there, # could verify a few more tables in the future, including # row content of the tables. store = self.settings.create_store() if SystemTable.is_available(store): store.close() return False store.close() # okay, we have a database which exists and doesn't have # the "SystemTable" SQL table present, means that we cannot use # it and should warn the user # Not 100% correct, should perhaps say "unix socket" address = self.settings.address or "localhost" msg = _("Database {dbname} at {address}:{port} is not " "a Stoq database.").format(dbname=self.settings.dbname, address=address, port=self.settings.port) description = _( "Stoq was able to succesfully connect to the database " "{dbname} at the database server {address}, however it " "is not a Stoq database or it was corrupted, please select " "another one.").format(dbname=self.settings.dbname, address=self.settings.address or "localhost") warning(msg, description) return True
def check_incomplete_database(self): logger.info('check_incomplete_database (db_is_local=%s)' % (self.db_is_local, )) # If we don't have postgres installed we cannot have # an incomplete database if self.db_is_local and not test_local_database(): return False # a database which doesn't exist isn't incomplete try: if not self.settings.has_database(): return False except DatabaseError, e: # If we're install stoq locally and hasn't created a database # user yet, we'll receive an authentiction error, there's no # way to reliably check for this but looking for a auth string # should make it work with posgres running in both english and # portuguese if self.db_is_local and 'auth' in str(e): return False msg = (_('It was not possible to connect to the database.') + '\n' + _('Check the server configuration and try again.')) warning(msg, str(e)) return True
def next_step(self): if self.wizard.db_is_local and not test_local_database(): return InstallPostgresStep(self.wizard, self) else: return CreateDatabaseStep(self.wizard, self)
def next_step(self): self.wizard.create_examples = not self.empty_database_radio.get_active() if self.wizard.db_is_local and not test_local_database(): return InstallPostgresStep(self.wizard, self) else: return CreateDatabaseStep(self.wizard, self)