コード例 #1
0
ファイル: config.py プロジェクト: leandrorchaves/stoq
 def _finish(self, returncode):
     logger.info('CreateDatabaseStep._finish (returncode=%s)' % returncode)
     if returncode:
         self.wizard.enable_back()
         # Failed to execute/create database
         if returncode == 30:
             # This probably happened because the user either;
             # - pressed cancel in the authentication popup
             # - user erred the password 3 times
             # Allow him to try again
             if yesno(_("Something went wrong while trying to create "
                        "the database. Try again?"),
                      gtk.RESPONSE_NO, _("Change settings"), _("Try again")):
                 return
             self._launch_stoqdbadmin()
             return
         else:
             # Unknown error, just inform user that something went wrong.
             self.expander.set_expanded(True)
             warning(_("Something went wrong while trying to create "
                       "the Stoq database"))
         return
     self.label.set_text("")
     self.wizard.load_config_and_call_setup()
     create_default_profile_settings()
     ensure_admin_user(self.wizard.config.get_password())
     self.progressbar.set_text(_("Done."))
     self.progressbar.set_fraction(1.0)
     self.wizard.enable_next()
     self.done_label.set_markup(
         _("Installation successful, click <b>Forward</b> to continue."))
コード例 #2
0
 def _finish(self, returncode):
     logger.info('CreateDatabaseStep._finish (returncode=%s)' % returncode)
     if returncode:
         self.wizard.enable_back()
         # Failed to execute/create database
         if returncode == 30:
             # This probably happened because the user either;
             # - pressed cancel in the authentication popup
             # - user erred the password 3 times
             # Allow him to try again
             if yesno(
                     _("Something went wrong while trying to create "
                       "the database. Try again?"), gtk.RESPONSE_NO,
                     _("Change settings"), _("Try again")):
                 return
             self._launch_stoqdbadmin()
             return
         else:
             # Unknown error, just inform user that something went wrong.
             self.expander.set_expanded(True)
             warning(
                 _("Something went wrong while trying to create "
                   "the Stoq database"))
         return
     self.label.set_text("")
     self.wizard.load_config_and_call_setup()
     create_default_profile_settings()
     ensure_admin_user(self.wizard.config.get_password())
     self.progressbar.set_text(_("Done."))
     self.progressbar.set_fraction(1.0)
     self.wizard.enable_next()
     self.done_label.set_markup(
         _("Installation successful, click <b>Forward</b> to continue."))
コード例 #3
0
ファイル: testsuite.py プロジェクト: 5l1v3r1/stoq-1
def bootstrap_suite(address=None,
                    dbname=None,
                    port=5432,
                    username=None,
                    password=u"",
                    station_name=None,
                    quick=False,
                    extra_plugins=None):
    """
    Test.
    :param address:
    :param dbname:
    :param port:
    :param username:
    :param password:
    :param station_name:
    :param quick:
    """
    os.environ['STOQ_TESTSUIT_RUNNING'] = '1'

    # This will only be required when we use uuid.UUID instances
    # for UUIDCol
    #import psycopg2.extras
    #psycopg2.extras.register_uuid()

    empty = provide_database_settings(dbname,
                                      address,
                                      port,
                                      username,
                                      password,
                                      createdb=not quick)

    # Reset the user settings (loaded from ~/.stoq/settings), so that user
    # preferences don't affect the tests.
    settings = get_settings()
    settings.reset()

    if quick and not empty:
        provide_utilities(station_name)
        _enable_plugins(extra_plugins=extra_plugins)
        return

    initialize_system(testsuite=True, force=True)

    # Commit before trying to apply patches which requires an exclusive lock
    # to all tables.
    _enable_plugins(extra_plugins=extra_plugins)
    ensure_admin_user(u"")
    create(utilities=True, create_users=True)
コード例 #4
0
ファイル: testsuite.py プロジェクト: tmaxter/stoq
def bootstrap_suite(address=None,
                    dbname=None,
                    port=5432,
                    username=None,
                    password=u"",
                    station_name=None,
                    quick=False):
    """
    Test.
    :param address:
    :param dbname:
    :param port:
    :param username:
    :param password:
    :param station_name:
    :param quick:
    """

    empty = provide_database_settings(dbname,
                                      address,
                                      port,
                                      username,
                                      password,
                                      create=not quick)

    # Reset the user settings (loaded from ~/.stoq/settings), so that user
    # preferences don't affect the tests.
    settings = get_settings()
    settings.reset()

    if quick and not empty:
        provide_utilities(station_name)
        return

    # XXX: Why clearing_cache if initialize_system will drop the
    # database?!
    ParameterAccess.clear_cache()

    initialize_system(testsuite=True, force=True)

    # Commit before trying to apply patches which requires an exclusive lock
    # to all tables.
    _enable_plugins()
    ensure_admin_user(u"")
    create(utilities=True)
コード例 #5
0
ファイル: testsuite.py プロジェクト: rosalin/stoq
def bootstrap_suite(address=None, dbname=None, port=5432, username=None,
                    password=u"", station_name=None, quick=False):
    """
    Test.
    :param address:
    :param dbname:
    :param port:
    :param username:
    :param password:
    :param station_name:
    :param quick:
    """

    # This will only be required when we use uuid.UUID instances
    # for UUIDCol
    #import psycopg2.extras
    #psycopg2.extras.register_uuid()

    empty = provide_database_settings(dbname, address, port, username, password,
                                      create=not quick)

    # Reset the user settings (loaded from ~/.stoq/settings), so that user
    # preferences don't affect the tests.
    settings = get_settings()
    settings.reset()

    if quick and not empty:
        provide_utilities(station_name)
        _enable_plugins()
        return

    # XXX: Why clearing_cache if initialize_system will drop the
    # database?!
    ParameterAccess.clear_cache()

    initialize_system(testsuite=True, force=True)

    # Commit before trying to apply patches which requires an exclusive lock
    # to all tables.
    _enable_plugins()
    ensure_admin_user(u"")
    create(utilities=True)