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


Python Config.save_config方法代码示例

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


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

示例1: execute

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

        # save prefix
        local_prefix = self.get_value("local_prefix")
        self.server_prefix = Config.get_value("install", "server")

        if not local_prefix and not self.server_prefix:
            raise TacticException("Cannot have empty local server prefix")

        if local_prefix and local_prefix != self.server_prefix:
            Config.set_value("install", "server", local_prefix)

            Config.save_config()

        self.project_code = self.get_value("project")
        if not self.project_code:
            self.project_code = Project.get_project_code()


        # create a share
        share = SearchType.create("sthpw/sync_server")
        self.handle_info(share)
        self.handle_sync_mode(share)

        share.commit()
开发者ID:mincau,项目名称:TACTIC,代码行数:27,代码来源:sync_settings_wdg.py

示例2: execute

# 需要导入模块: from pyasm.common import Config [as 别名]
# 或者: from pyasm.common.Config import save_config [as 别名]
    def execute(self):
        web = WebContainer.get_web()

        xml_string = Config.get_xml_data().to_string()

        keys = web.get_form_keys()
        for key in keys:
            value = web.get_form_value(key)

            is_config_key = key.find("/") != -1

            if key == "database/password":
                self.handle_password()

            elif is_config_key:
                module_name, key = key.split("/")
                Config.set_value(module_name, key, value )


        xml_string2 = Config.get_xml_data().to_string()

        if xml_string2 != xml_string:
            Config.save_config()
开发者ID:mincau,项目名称:TACTIC,代码行数:25,代码来源:setup_manager_wdg.py

示例3: save_config

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

示例4: ask_questions

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

#.........这里部分代码省略.........
                vendor = default_vendor
            print

            if vendor in ['PostgreSQL', 'Oracle']:
                break
            else:
                print "ERROR: Vendor must one of 'PostgreSQL' or 'Oracle'"
                print


        # set server
        default_server = Config.get_value("database", "server")
        if not default_server:
            default_server = "localhost"
        print
        print "Please enter database server hostname or IP address:"
        print
        server = raw_input("(%s) -> " % default_server)
        if not server:
            server = default_server
        print



        # set the user
        default_user = Config.get_value("database", "user")
        if not default_user:
            default_user = "__EMPTY__"
        print
        print "Please enter user name accessing the database:"
        if vendor == "Oracle":
            print "    (To access Oracle using schema names, type '__EMPTY__')"
        print
        user = raw_input("(%s) -> " % default_user)
        if not user:
            user = default_user
        print



        # set password
        from pyasm.search import DbPasswordUtil
        current_password = DbPasswordUtil.get_password()
        password = 0
        password2 = 1
        print
        print "Please enter database password:"
        print "  (ENTER to keep password, '__EMPTY__' for empty password)"

        import getpass
        while password != password2:
            print
            password = getpass.getpass("Enter Password -> ")

            if password:
                password2 = getpass.getpass("Confirm Password -> ")
            else:
                password = current_password
                password2 = password
                break

            print

            if password == password2:
                break
            else:
                print "ERROR: Passwords do not match"


        # Summary:
        print
        print "Vendor:   [%s]" % vendor
        print "Server:   [%s]" % server
        print "User:     [%s]" % user
        print

        ok = raw_input("Save to config (N/y) -> ")
        if ok.lower() != "y":
            print "Aborted"
            return


        # save the info
        from pyasm.search import DbPasswordUtil
        DbPasswordUtil.set_password(password)

        Config.set_value("database", "vendor", vendor)
        Config.set_value("database", "server", server)

        if user == "__EMPTY__":
            user = ""
        Config.set_value("database", "user", user)
        Config.save_config()
        path = Config.get_config_path()

        print
        print "Saved new database information to [%s].  Please restart TACTIC for the changes to take effect" % path
        print

        '''
开发者ID:0-T-0,项目名称:TACTIC,代码行数:104,代码来源:change_db_info.py

示例5: execute

# 需要导入模块: from pyasm.common import Config [as 别名]
# 或者: from pyasm.common.Config import save_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

示例6:

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

import tacticenv
from pyasm.common import Config
from pyasm.search import DbPasswordUtil

DbPasswordUtil.set_password('')

Config.set_value("database", "server", os.environ['TACTIC_POSTGRES_PORT_5432_TCP_ADDR'])
Config.save_config()
开发者ID:Eibriel,项目名称:scripts,代码行数:12,代码来源:database_conf.py

示例7: save_config

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


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