本文整理汇总了Python中pyasm.common.Config.remove方法的典型用法代码示例。如果您正苦于以下问题:Python Config.remove方法的具体用法?Python Config.remove怎么用?Python Config.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.common.Config
的用法示例。
在下文中一共展示了Config.remove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: configure_install
# 需要导入模块: from pyasm.common import Config [as 别名]
# 或者: from pyasm.common.Config import remove [as 别名]
def configure_install(my):
web = WebContainer.get_web()
default_project = web.get_form_value("install/default_project")
tmp_dir = web.get_form_value("install/tmp_dir")
if tmp_dir:
Config.set_value("install", "tmp_dir", tmp_dir)
else:
Config.set_value("install", "tmp_dir", '')
if default_project:
Config.set_value("install", "default_project", default_project)
else:
Config.remove("install", "default_project")
示例2: configure_db
# 需要导入模块: from pyasm.common import Config [as 别名]
# 或者: from pyasm.common.Config import remove [as 别名]
def configure_db(my):
web = WebContainer.get_web()
vendor = web.get_form_value("database/vendor")
if vendor == 'Sqlite':
# take the current files and copy them to the database folder
db_dir = web.get_form_value("database/sqlite_db_dir")
if not db_dir:
raise TacticException("No Folder configured for Sqlite Database")
if not os.path.exists(db_dir):
os.makedirs(db_dir)
# check to see if the sthpw database is in this folder
sthpw_path = "%s/sthpw.db" % (db_dir)
if not os.path.exists(sthpw_path):
# copy the default database over
install_dir = Environment.get_install_dir()
template_db = "%s/src/install/start/db/sthpw.db" % install_dir
shutil.copy(template_db, db_dir)
Config.set_value("database", "sqlite_db_dir", db_dir)
Config.remove("database", "server")
Config.remove("database", "port")
Config.remove("database", "user")
Config.remove("database", "password")
else:
defaults = DEFAULTS[vendor]
default_server = defaults['server']
default_port = defaults['port']
default_user = defaults['user']
default_password = defaults['password']
Config.remove("database", "sqlite_db_dir")
# get the info
server = web.get_form_value("server")
if not server:
server = default_server
port = web.get_form_value("port")
if not port:
port = default_port
else:
port = int(port)
user = web.get_form_value("user")
if not user:
user = default_user
password = web.get_form_value("password")
if not password:
password = default_password
if server:
Config.set_value("database", "server", server)
else:
#Config.remove("database", "server")
Config.set_value("database", "server", "")
if port:
Config.set_value("database", "port", port)
else:
#Config.remove("database", "port")
Config.set_value("database", "port", "")
if user:
Config.set_value("database", "user", user)
else:
#Config.remove("database", "user")
Config.set_value("database", "user", "")
if password:
Config.set_value("database", "password", password)
else:
Config.set_value("database", "password", "")
#Config.remove("database", "password")
# save the database
Config.set_value("database", "vendor", vendor)