本文整理汇总了Python中pyasm.search.DatabaseImpl.clear_table_cache方法的典型用法代码示例。如果您正苦于以下问题:Python DatabaseImpl.clear_table_cache方法的具体用法?Python DatabaseImpl.clear_table_cache怎么用?Python DatabaseImpl.clear_table_cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.search.DatabaseImpl
的用法示例。
在下文中一共展示了DatabaseImpl.clear_table_cache方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from pyasm.search import DatabaseImpl [as 别名]
# 或者: from pyasm.search.DatabaseImpl import clear_table_cache [as 别名]
#.........这里部分代码省略.........
from_template_path = "%s/%s" % (base_dir, template_name)
from_data_path = "%s/%s" % (base_dir, data_name)
from_file_path = "%s/%s" % (base_dir, file_name)
to_file_path = from_file_path
# copy the files
# ???? why are we copying here?
shutil.copy(from_template_path, to_template_path)
shutil.copy(from_data_path, to_data_path)
else:
# TEST TEST TEST
ticket = server.get_value("server")
remote_server = TacticServerStub(
protocol='xmlrpc',
server=server,
project=project_code,
#user=user,
#password=password,
ticket=ticket,
)
class_name = 'tactic.ui.sync.SyncCreateTemplateCmd'
kwargs = {
'project_code': project_code
}
remote_server.execute_cmd(class_name, kwargs)
base_url = "http://%s/assets/_temp/" % server
# download and install the files
from_template_path = "%s/%s_template-%s.zip" % (base_url, project_code, version)
from_data_path = "%s/%s_data-%s.zip" % (base_url, project_code, version)
remote_server.download(from_template_path, to_dir)
remote_server.download(from_data_path, to_dir)
# This makes the pretty big assumption that this is an official template
if not os.path.exists(to_template_path):
raise Exception("Path [%s] does not exist" % to_template_path)
template_code = project_code
try:
new_project = False
from tactic.command import ProjectTemplateInstallerCmd
cmd = ProjectTemplateInstallerCmd(project_code=project_code, path=to_template_path,template_code=template_code, new_project=new_project, version=version)
cmd.execute()
Project.set_project(project_code)
project = Project.get()
# NOTE: this avoids breaking on search.py, line 203, where it checks
# for tables. The caching mechanism for what tables are in the
# database need to be refreshed once a template is imported
from pyasm.search import DatabaseImpl, DbContainer
DatabaseImpl.clear_table_cache()
# import from a plugin
kwargs = {
#'base_dir': base_dir,
#'manifest': self.xml.to_string(),
'code': "%s_data" % project_code,
'zip_path': to_data_path,
}
from tactic.command import PluginInstaller
cmd = PluginInstaller(**kwargs)
cmd.execute()
# create zip of the project files
if os.path.exists(to_file_path):
from pyasm.common import ZipUtil
zip_util = ZipUtil()
asset_dir = Environment.get_asset_dir()
to_file_dir = os.path.dirname(to_file_path)
zip_util.extract(to_file_path, base_dir=asset_dir)
except Exception as e:
print("Error: ", str(e))
raise