当前位置: 首页>>代码示例>>Python>>正文


Python Config.reload_config方法代码示例

本文整理汇总了Python中pyasm.common.Config.reload_config方法的典型用法代码示例。如果您正苦于以下问题:Python Config.reload_config方法的具体用法?Python Config.reload_config怎么用?Python Config.reload_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyasm.common.Config的用法示例。


在下文中一共展示了Config.reload_config方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from pyasm.common import Config [as 别名]
# 或者: from pyasm.common.Config import reload_config [as 别名]
    def __init__(my, port=''):

        # It is possible on startup that the database is not running.
        from pyasm.search import DbContainer, DatabaseException, Sql

        try:
            sql = DbContainer.get("sthpw")
            if sql.get_database_type() != "MongoDb":
                # before batch, clean up the ticket with a NULL code
                if os.getenv('TACTIC_MODE') != 'production':
                    sql.do_update('DELETE from "ticket" where "code" is NULL;')
                else:
                    start_port = Config.get_value("services", "start_port")
                    if start_port:
                        start_port = int(start_port)
                    else:
                        start_port = 8081
                    if port and int(port) == start_port:
                         sql.do_update('DELETE from "ticket" where "code" is NULL;')
        except DatabaseException, e:
            # TODO: need to work on this
            print "ERROR: could not connect to [sthpw] database"
            #os.environ["TACTIC_CONFIG_PATH"] = Config.get_default_config_path()
            #Sql.set_default_vendor("Sqlite")

            Config.set_tmp_config()
            Config.reload_config()

            # try connecting again
            try:
                sql = DbContainer.get("sthpw")
            except:
                print "Could not connect to the database."
                raise
开发者ID:funic,项目名称:TACTIC,代码行数:36,代码来源:cherrypy_startup.py

示例2: execute

# 需要导入模块: from pyasm.common import Config [as 别名]
# 或者: from pyasm.common.Config import reload_config [as 别名]
    def execute(my):

        # make sure tmp config is unset.
        Config.unset_tmp_config()
        Config.reload_config()

        web = WebContainer.get_web()

        vendor = web.get_form_value("database/vendor")


        if vendor == 'Sqlite':
            db_dir = web.get_form_value("database/sqlite_db_dir")
            database = "sthpw"
            db_path = "%s/%s.db" % (db_dir, database)
            if os.path.exists(db_path):
                return

        elif vendor == 'PostgreSQL':
            my.test_postgres(vendor)
            return

        elif vendor in ['MySQL','SQLServer','Oracle']:
            my.test_postgres(vendor)
            return

        my.info['error'] = "Cannot connect to database"
开发者ID:blezek,项目名称:TACTIC,代码行数:29,代码来源:db_config_wdg.py

示例3: execute

# 需要导入模块: from pyasm.common import Config [as 别名]
# 或者: from pyasm.common.Config import reload_config [as 别名]
    def execute(self):
        self.section = None

        # make sure tmp config is unset.
        Config.unset_tmp_config()
        Config.reload_config()

        web = WebContainer.get_web()

        # read the current config file.


        # copy config to the path
        config_path = Config.get_config_path()
        if not os.path.exists(config_path):
            print "Installing default config file"

            dirname = os.path.dirname(config_path)
            if not os.path.exists(dirname):
                os.makedirs(dirname)

            if os.name == 'nt':
                osname = 'win32'
            else:
                osname = 'linux'

            install_dir = Environment.get_install_dir()
            install_config_path = "%s/src/install/start/config/tactic_%s-conf.xml" % ( install_dir, osname)

            shutil.copy(install_config_path, dirname)

        try:
            self.configure_db()
            self.configure_install()
            self.configure_mail_services()
            self.configure_gen_services()
            self.configure_asset_dir()
            self.configure_palette()
            self.configure_security()
        except Exception as e:
            raise TacticException('Error in [%s]: %s'%(self.section, e.__str__()))
        # FIXME: if this all fails, then revert back
        
        self.save_config()

        # after saving the config, test the database
        self.load_bootstrap()

        # remove the first run file
        data_dir = Environment.get_data_dir()
        path = "%s/first_run" % data_dir
        if os.path.exists(path):
            os.unlink(path)


        self.restart_program()
开发者ID:mincau,项目名称:TACTIC,代码行数:58,代码来源:db_config_wdg.py

示例4: execute

# 需要导入模块: from pyasm.common import Config [as 别名]
# 或者: from pyasm.common.Config import reload_config [as 别名]
    def execute(my):
        my.section = None

        # make sure tmp config is unset.
        Config.unset_tmp_config()
        Config.reload_config()

        web = WebContainer.get_web()

        # read the current config file.


        # copy config to the path
        config_path = Config.get_config_path()
        if not os.path.exists(config_path):
            print "Installing default config file"

            dirname = os.path.dirname(config_path)
            if not os.path.exists(dirname):
                os.makedirs(dirname)

            if os.name == 'nt':
                osname = 'win32'
            else:
                osname = 'linux'

            install_dir = Environment.get_install_dir()
            install_config_path = "%s/src/install/start/config/tactic_%s-conf.xml" % ( install_dir, osname)

            shutil.copy(install_config_path, dirname)

        try:
            my.configure_db()
            my.configure_install()
            my.configure_mail_services()
            my.configure_gen_services()
            my.configure_asset_dir()
            my.configure_palette()
            my.configure_security()
        except Exception, e:
            raise TacticException('Error in [%s]: %s'%(my.section, e.__str__()))
开发者ID:0-T-0,项目名称:TACTIC,代码行数:43,代码来源:db_config_wdg.py

示例5: save_config

# 需要导入模块: from pyasm.common import Config [as 别名]
# 或者: from pyasm.common.Config import reload_config [as 别名]
 def save_config(my):
     Config.save_config()
     Config.reload_config()
开发者ID:blezek,项目名称:TACTIC,代码行数:5,代码来源:db_config_wdg.py

示例6: execute

# 需要导入模块: from pyasm.common import Config [as 别名]
# 或者: from pyasm.common.Config import reload_config [as 别名]

#.........这里部分代码省略.........
            file_paths = [upload_path]
            file_types = [file_type]

            source_paths = [upload_path]
            from pyasm.biz import IconCreator
            if os.path.isfile(upload_path):
                icon_creator = IconCreator(upload_path)
                icon_creator.execute()

                web_path = icon_creator.get_web_path()
                icon_path = icon_creator.get_icon_path()
                if web_path:
                    file_paths = [upload_path, web_path, icon_path]
                    file_types = [file_type, 'web', 'icon']

            from pyasm.checkin import FileCheckin
            checkin = FileCheckin(project, context='icon', file_paths=file_paths, file_types=file_types)
            checkin.execute()

        # find project's base_type
        base_type = project.get_base_type()

        if not base_type and project_type =='unittest':
            base_type = 'unittest'
        elif not base_type:
            base_type = 'simple'


        # get the database for this project
        db_resource = project.get_project_db_resource()

        database = db_resource.get_database_impl()
        #database = DatabaseImpl.get()
        database_type = database.get_database_type()
        if database_type == 'Oracle':
            raise TacticException("Creation of project is not supported. Please create manually")




        # creating project database
        print "Creating database '%s' ..." % project_code
        try:
            # create the datbase
            database.create_database(db_resource)
        except Exception as e:
            print str(e)
            print "WARNING: Error creating database [%s]" % project_code





        # import the appropriate schema with config first
        database.import_schema(db_resource, base_type)

        self.create_schema(project_code)

        # before we upgrade, we have to commit the transaction
        # This is because upgrade actually run as separate processes
        # so if not commit has been made, the tables from importing the
        # schema will not have existed yet
        DbContainer.commit_thread_sql()


        self.upgrade()

        # import the appropriate data
        database.import_default_data(db_resource, base_type)


        # import default links
        if use_default_side_bar:
            self.import_default_side_bar()


        # create specified stypes
        self.create_search_types()


        # create theme
        if project_theme:
            self.create_theme(project_theme)



        # set as main project
        is_main_project = self.kwargs.get("is_main_project")
        if is_main_project in [True,'true','on']:
            Config.set_value("install", "default_project", project_code)
            Config.save_config()
            Config.reload_config()

        # initiate the DbContainer
        DbContainer.get('sthpw')


        self.info['result'] = "Finished creating project [%s]."%project_code

        print "Done."
开发者ID:mincau,项目名称:TACTIC,代码行数:104,代码来源:create_project_cmd.py

示例7: save_config

# 需要导入模块: from pyasm.common import Config [as 别名]
# 或者: from pyasm.common.Config import reload_config [as 别名]
 def save_config(self):
     Config.save_config()
     Config.reload_config()
开发者ID:mincau,项目名称:TACTIC,代码行数:5,代码来源:db_config_wdg.py

示例8: __init__

# 需要导入模块: from pyasm.common import Config [as 别名]
# 或者: from pyasm.common.Config import reload_config [as 别名]
    def __init__(self, port=''):

        # It is possible on startup that the database is not running.
        from pyasm.common import Environment
        from pyasm.search import DbContainer, DatabaseException, Sql
        plugin_dir = Environment.get_plugin_dir()
        sys.path.insert(0, plugin_dir)

        try:
            sql = DbContainer.get("sthpw")
            if sql.get_database_type() != "MongoDb":
                # before batch, clean up the ticket with a NULL code
                if os.getenv('TACTIC_MODE') != 'production':
                    sql.do_update('DELETE from "ticket" where "code" is NULL')
                else:
                    start_port = Config.get_value("services", "start_port")
                    if start_port:
                        start_port = int(start_port)
                    else:
                        start_port = 8081
                    if port and int(port) == start_port:
                         sql.do_update('DELETE from "ticket" where "code" is NULL')
        except DatabaseException as e:
            # TODO: need to work on this
            print("ERROR: could not connect to [sthpw] database")
            #os.environ["TACTIC_CONFIG_PATH"] = Config.get_default_config_path()
            #Sql.set_default_vendor("Sqlite")

            Config.set_tmp_config()
            Config.reload_config()

            # try connecting again
            try:
                sql = DbContainer.get("sthpw")
            except:
                print "Could not connect to the database."
                raise


        # is it CherryPyStartup's responsibility to start batch?
        from pyasm.security import Batch
        Batch()

        self.site_dir = os.getenv("TACTIC_SITE_DIR")
        self.install_dir = os.getenv("TACTIC_INSTALL_DIR")

        # set up a simple environment.  May need a more complex one later
        self.env = Environment()


        self.setup_env()
        self.config = self.setup_sites()

        self.init_only = False

        cherrypy.startup = self


        # this initializes the web.
        # - sets up virtual implied tiggers 
        from web_init import WebInit
        WebInit().execute()

        # Windows should handle fine
        #start up the caching system if it's not windows
        cache_mode = Config.get_value("install", "cache_mode")
        if not cache_mode:
            cache_mode = 'complete'
            if os.name == 'nt':
                cache_mode = 'basic'
            
        from cache_startup import CacheStartup
        cmd = CacheStartup(mode=cache_mode)
        cmd.execute()
        cmd.init_scheduler()

        # DEPRECATED (but keeping it around"
        """
        # start up the queue system ...
        if Config.get_value("sync", "enabled") == "true":
            # start up the sync system ...
            print("Starting Transaction Sync ...")
            from tactic.command import TransactionQueueManager
            TransactionQueueManager.start()

            # start up the sync system ...
            print("Starting Watch Folder Service ...")
            from tactic.command import WatchServerFolderTask
            WatchServerFolderTask.start()
        """

        # start up scheduled triggers
        #from tactic.command import ScheduledTriggerMonitor
        #ScheduledTriggerMonitor.start()

        #from pyasm.web import Translation
        #Translation.install()


        # close all the threads in this startup thread
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:cherrypy_startup.py


注:本文中的pyasm.common.Config.reload_config方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。