Пример #1
0
def initialize_system(password=None, testsuite=False,
                      force=False):
    """Call all the necessary methods to startup Stoq applications for
    every purpose: production usage, testing or demonstration
    """

    log.info("Initialize_system")
    try:
        db_settings.clean_database(db_settings.dbname, force=force)
        create_base_schema()
        create_log("INIT START")
        store = new_store()
        populate_initial_data(store)
        register_accounts(store)
        register_payment_methods(store)
        from stoqlib.domain.uiform import create_default_forms
        create_default_forms(store)
        store.commit(close=True)
        ensure_sellable_constants()
        ensure_system_parameters()
        _ensure_card_providers()
        create_default_profiles()
        _install_invoice_templates()

        if not testsuite:
            create_default_profile_settings()
            ensure_admin_user(password)
    except Exception, e:
        raise
        if not testsuite:
            collect_traceback(sys.exc_info(), submit=True)
        raise SystemExit("Could not initialize system: %r" % (e, ))
Пример #2
0
def initialize_system(password=None, testsuite=False, force=False):
    """Call all the necessary methods to startup Stoq applications for
    every purpose: production usage, testing or demonstration
    """

    log.info("Initialize_system")
    try:
        db_settings.clean_database(db_settings.dbname, force=force)
        create_base_schema()
        create_log("INIT START")
        store = new_store()
        populate_initial_data(store)
        register_accounts(store)
        register_payment_methods(store)
        from stoqlib.domain.uiform import create_default_forms
        create_default_forms(store)
        store.commit(close=True)
        ensure_sellable_constants()
        ensure_system_parameters()
        _ensure_card_providers()
        create_default_profiles()
        _install_invoice_templates()

        if not testsuite:
            create_default_profile_settings()
            ensure_admin_user(password)
    except Exception as e:
        raise
        if not testsuite:
            collect_traceback(sys.exc_info(), submit=True)
        raise SystemExit("Could not initialize system: %r" % (e, ))
    create_log("INIT DONE")
Пример #3
0
def initialize_system(password=None,
                      testsuite=False,
                      force=False,
                      empty=False):
    """Call all the necessary methods to startup Stoq applications for
    every purpose: production usage, testing or demonstration
    :param force: When False, we will ask the user if he really wants to replace
      the existing database.
    :param empty: If we should create the database without any data. When we do
      this the database will not be really usable by stoq. This should be used
      to create a database for the syncronization server.
    """

    log.info("Initialize_system")
    try:
        db_settings.clean_database(db_settings.dbname, force=force)
        create_base_schema()
        create_log.info("INIT START")
        store = new_store()
        if not empty:
            populate_initial_data(store)
            register_accounts(store)
            register_payment_methods(store)
            from stoqlib.domain.uiform import create_default_forms
            create_default_forms(store)
            ensure_sellable_constants(store)
            sysparam.ensure_system_parameters(store)
            store.commit(close=True)
            _ensure_card_providers()
            create_default_profiles()
            _install_invoice_templates()

            if not testsuite:
                create_default_profile_settings()
                ensure_admin_user(password)
    except Exception:
        # if not testsuite:
        #     collect_traceback(sys.exc_info(), submit=True)
        # raise SystemExit("Could not initialize system: %r" % (e, ))
        raise
    create_log.info("INIT DONE")
Пример #4
0
def initialize_system(password=None, testsuite=False,
                      force=False, empty=False):
    """Call all the necessary methods to startup Stoq applications for
    every purpose: production usage, testing or demonstration
    :param force: When False, we will ask the user if he really wants to replace
      the existing database.
    :param empty: If we should create the database without any data. When we do
      this the database will not be really usable by stoq. This should be used
      to create a database for the syncronization server.
    """

    log.info("Initialize_system")
    try:
        db_settings.clean_database(db_settings.dbname, force=force)
        create_base_schema()
        create_log.info("INIT START")
        store = new_store()
        if not empty:
            populate_initial_data(store)
            register_accounts(store)
            register_payment_methods(store)
            from stoqlib.domain.uiform import create_default_forms
            create_default_forms(store)
            ensure_sellable_constants(store)
            sysparam.ensure_system_parameters(store)
            store.commit(close=True)
            _ensure_card_providers()
            create_default_profiles()
            _install_invoice_templates()

            if not testsuite:
                create_default_profile_settings()
                ensure_admin_user(password)
    except Exception:
        # if not testsuite:
        #     collect_traceback(sys.exc_info(), submit=True)
        # raise SystemExit("Could not initialize system: %r" % (e, ))
        raise
    create_log.info("INIT DONE")